diff mbox series

[FFmpeg-devel,27/40] avcodec/avrndec: Fix memleak on error

Message ID 20200914052747.124118-11-andreas.rheinhardt@gmail.com
State Accepted
Commit 3c2128df7ffdb32a3ef34044f9a4c2f15dc1776f
Headers show
Series [FFmpeg-devel,01/16] avcodec/snowdec: Use ff_snow_common_init() directly | expand

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
If ff_codec_open2_recursive() fails, the already allocated
AVCodecContext leaks. Fix this by setting the FF_CODEC_CAP_INIT_CLEANUP
flag.

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

Comments

Paul B Mahol Sept. 14, 2020, 4:29 p.m. UTC | #1
On Mon, Sep 14, 2020 at 07:27:34AM +0200, Andreas Rheinhardt wrote:
> If ff_codec_open2_recursive() fails, the already allocated
> AVCodecContext leaks. Fix this by setting the FF_CODEC_CAP_INIT_CLEANUP
> flag.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/avrndec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
lgtm
> diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
> index a4b6fadfc8..c5a60acd4f 100644
> --- a/libavcodec/avrndec.c
> +++ b/libavcodec/avrndec.c
> @@ -170,5 +170,5 @@ AVCodec ff_avrn_decoder = {
>      .close          = end,
>      .decode         = decode_frame,
>      .max_lowres     = 3,
> -    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
> +    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | 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/avrndec.c b/libavcodec/avrndec.c
index a4b6fadfc8..c5a60acd4f 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -170,5 +170,5 @@  AVCodec ff_avrn_decoder = {
     .close          = end,
     .decode         = decode_frame,
     .max_lowres     = 3,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };