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

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun May 19 12:55:48 EEST 2024


Andreas Rheinhardt:
> Fixes Coverity issue #1516957.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at 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



More information about the ffmpeg-devel mailing list