diff mbox series

[FFmpeg-devel,07/30] avcodec/gif: Fix leaks upon allocation error

Message ID 20200915074000.102622-7-andreas.rheinhardt@gmail.com
State Accepted
Commit 8da8774d8eb1d5dec830f36d2e6b0ace1b16e2f5
Headers show
Series [FFmpeg-devel,01/30] avcodec/flashsvenc: Avoid allocation of buffer, fix memleak
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 15, 2020, 7:39 a.m. UTC
If one of several allocations the gif encoder performs in its init
function fails, the successfull allocations leak. Fix this by adding the
FF_CODEC_CAP_INIT_CLEANUP.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/gif.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paul B Mahol Sept. 15, 2020, 9:10 a.m. UTC | #1
On Tue, Sep 15, 2020 at 09:39:37AM +0200, Andreas Rheinhardt wrote:
> If one of several allocations the gif encoder performs in its init
> function fails, the successfull allocations leak. Fix this by adding the
> FF_CODEC_CAP_INIT_CLEANUP.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/gif.c | 1 +
>  1 file changed, 1 insertion(+)

ok

> 
> diff --git a/libavcodec/gif.c b/libavcodec/gif.c
> index 65a76cfde4..de41992851 100644
> --- a/libavcodec/gif.c
> +++ b/libavcodec/gif.c
> @@ -497,4 +497,5 @@ AVCodec ff_gif_encoder = {
>          AV_PIX_FMT_GRAY8, AV_PIX_FMT_PAL8, AV_PIX_FMT_NONE
>      },
>      .priv_class     = &gif_class,
> +    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>  };
> -- 
> 2.25.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 65a76cfde4..de41992851 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -497,4 +497,5 @@  AVCodec ff_gif_encoder = {
         AV_PIX_FMT_GRAY8, AV_PIX_FMT_PAL8, AV_PIX_FMT_NONE
     },
     .priv_class     = &gif_class,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };