diff mbox series

[FFmpeg-devel,16/30] avcodec/indeo5: Fix memleaks upon allocation error

Message ID 20200915074000.102622-16-andreas.rheinhardt@gmail.com
State Accepted
Commit d8fc69bd6a20394adf42406bf80bd06b4c8d7384
Headers show
Series [FFmpeg-devel,01/30] avcodec/flashsvenc: Avoid allocation of buffer, fix memleak | 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. 15, 2020, 7:39 a.m. UTC
ff_ivi_init_planes() might error out after having allocated some arrays.
Set the FF_CODEC_CAP_INIT_CLEANUP flag in order to free these arrays in
this case.

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

Comments

Paul B Mahol Sept. 15, 2020, 4:54 p.m. UTC | #1
On Tue, Sep 15, 2020 at 09:39:46AM +0200, Andreas Rheinhardt wrote:
> ff_ivi_init_planes() might error out after having allocated some arrays.
> Set the FF_CODEC_CAP_INIT_CLEANUP flag in order to free these arrays in
> this case.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/indeo5.c | 2 ++
>  1 file changed, 2 insertions(+)

looks ok
    
> 
> diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c
> index 4ccdbcaf0a..ac15d31fef 100644
> --- a/libavcodec/indeo5.c
> +++ b/libavcodec/indeo5.c
> @@ -30,6 +30,7 @@
>  #define BITSTREAM_READER_LE
>  #include "avcodec.h"
>  #include "get_bits.h"
> +#include "internal.h"
>  #include "ivi.h"
>  #include "ivi_dsp.h"
>  #include "indeo5data.h"
> @@ -692,4 +693,5 @@ AVCodec ff_indeo5_decoder = {
>      .close          = ff_ivi_decode_close,
>      .decode         = ff_ivi_decode_frame,
>      .capabilities   = AV_CODEC_CAP_DR1,
> +    .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/indeo5.c b/libavcodec/indeo5.c
index 4ccdbcaf0a..ac15d31fef 100644
--- a/libavcodec/indeo5.c
+++ b/libavcodec/indeo5.c
@@ -30,6 +30,7 @@ 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
 #include "get_bits.h"
+#include "internal.h"
 #include "ivi.h"
 #include "ivi_dsp.h"
 #include "indeo5data.h"
@@ -692,4 +693,5 @@  AVCodec ff_indeo5_decoder = {
     .close          = ff_ivi_decode_close,
     .decode         = ff_ivi_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };