diff mbox series

[FFmpeg-devel,29/40] avcodec/cfhdenc: Fix leaks on allocation errors

Message ID 20200914052747.124118-13-andreas.rheinhardt@gmail.com
State Accepted
Commit a489b6a8e398614d8f719b318bbb02db3da4510d
Headers show
Series [FFmpeg-devel,01/16] avcodec/snowdec: Use ff_snow_common_init() directly
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. 14, 2020, 5:27 a.m. UTC
The CineForm HD encoder attempts to allocate several buffers in its init
function; yet if only some of these allocations succeed, the
successfully allocated buffers leak. This is fixed by setting the
FF_CODEC_CAP_INIT_CLEANUP flag.

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

Comments

Paul B Mahol Sept. 14, 2020, 8:17 a.m. UTC | #1
On Mon, Sep 14, 2020 at 07:27:36AM +0200, Andreas Rheinhardt wrote:
> The CineForm HD encoder attempts to allocate several buffers in its init
> function; yet if only some of these allocations succeed, the
> successfully allocated buffers leak. This is fixed by setting the
> FF_CODEC_CAP_INIT_CLEANUP flag.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---

lgtm
diff mbox series

Patch

diff --git a/libavcodec/cfhdenc.c b/libavcodec/cfhdenc.c
index 776b6da235..5554baefa3 100644
--- a/libavcodec/cfhdenc.c
+++ b/libavcodec/cfhdenc.c
@@ -919,4 +919,5 @@  AVCodec ff_cfhd_encoder = {
                           AV_PIX_FMT_GBRAP12,
                           AV_PIX_FMT_NONE
                         },
+    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
 };