diff mbox series

[FFmpeg-devel] avcodec/tiff: Fix leak on error

Message ID AS8P250MB074466D32CECB89FD21C8EA08FEE2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 2c94b1bbf101200c13293130cf86c9be9c397885
Headers show
Series [FFmpeg-devel] avcodec/tiff: Fix leak on error | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt May 17, 2024, 7:51 p.m. UTC
Fixes Coverity issue #1516957.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/tiff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer May 17, 2024, 9:21 p.m. UTC | #1
On Fri, May 17, 2024 at 09:51:05PM +0200, Andreas Rheinhardt wrote:
> Fixes Coverity issue #1516957.

Please mark issues that you fixed in coverity accordingly so that others
(like me) see it and know what issues remain outstanding by well looking
at the list of outstanding issues

thx

[...]
Andreas Rheinhardt May 19, 2024, 9:55 a.m. UTC | #2
Andreas Rheinhardt:
> Fixes Coverity issue #1516957.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/tiff.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 19301d9e49..111ce3ea3a 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -2267,8 +2267,10 @@ again:
>              group_size = s->width * channels;
>  
>              tmpbuf = av_malloc(ssize);
> -            if (!tmpbuf)
> +            if (!tmpbuf) {
> +                av_free(five_planes);
>                  return AVERROR(ENOMEM);
> +            }
>  
>              if (s->avctx->pix_fmt == AV_PIX_FMT_RGBF32LE ||
>                  s->avctx->pix_fmt == AV_PIX_FMT_RGBAF32LE) {

Will apply this patch tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 19301d9e49..111ce3ea3a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -2267,8 +2267,10 @@  again:
             group_size = s->width * channels;
 
             tmpbuf = av_malloc(ssize);
-            if (!tmpbuf)
+            if (!tmpbuf) {
+                av_free(five_planes);
                 return AVERROR(ENOMEM);
+            }
 
             if (s->avctx->pix_fmt == AV_PIX_FMT_RGBF32LE ||
                 s->avctx->pix_fmt == AV_PIX_FMT_RGBAF32LE) {