diff mbox series

[FFmpeg-devel,35/45] avcodec/mjpegdec: Fix memleak upon init failure

Message ID 20201127010249.2724610-35-andreas.rheinhardt@gmail.com
State Accepted
Commit f3e645a7967d64df8a19c4e0eea93f17937913fb
Headers show
Series [FFmpeg-devel,01/45] avcodec/a64multienc: Fix memleak upon init failure
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 27, 2020, 1:02 a.m. UTC
This affected all decoders that used ff_mjpeg_decode_init() as init
function; and it also affected decoders that open jpeg decoders via
ff_codec_open2_recursive() as well as MxPEG.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/jpeglsdec.c | 2 +-
 libavcodec/mjpegbdec.c | 2 +-
 libavcodec/mjpegdec.c  | 4 ++--
 libavcodec/sp5xdec.c   | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

Comments

Anton Khirnov Dec. 4, 2020, 12:01 p.m. UTC | #1
Quoting Andreas Rheinhardt (2020-11-27 02:02:39)
> This affected all decoders that used ff_mjpeg_decode_init() as init
> function; and it also affected decoders that open jpeg decoders via
> ff_codec_open2_recursive() as well as MxPEG.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/jpeglsdec.c | 2 +-
>  libavcodec/mjpegbdec.c | 2 +-
>  libavcodec/mjpegdec.c  | 4 ++--
>  libavcodec/sp5xdec.c   | 4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)

Looks good.
diff mbox series

Patch

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 0b1e139048..1db6faa99c 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -553,5 +553,5 @@  AVCodec ff_jpegls_decoder = {
     .close          = ff_mjpeg_decode_end,
     .decode         = ff_mjpeg_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index 70ff4cf563..7666674908 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -163,5 +163,5 @@  AVCodec ff_mjpegb_decoder = {
     .decode         = mjpegb_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
     .max_lowres     = 3,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 147dd819e5..6cf8014490 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2888,7 +2888,7 @@  AVCodec ff_mjpeg_decoder = {
     .max_lowres     = 3,
     .priv_class     = &mjpegdec_class,
     .profiles       = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP |
                       FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
     .hw_configs     = (const AVCodecHWConfigInternal*[]) {
 #if CONFIG_MJPEG_NVDEC_HWACCEL
@@ -2914,6 +2914,6 @@  AVCodec ff_thp_decoder = {
     .flush          = decode_flush,
     .capabilities   = AV_CODEC_CAP_DR1,
     .max_lowres     = 3,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };
 #endif
diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
index 815f9ad50e..ad2e9b11a9 100644
--- a/libavcodec/sp5xdec.c
+++ b/libavcodec/sp5xdec.c
@@ -106,7 +106,7 @@  AVCodec ff_sp5x_decoder = {
     .decode         = sp5x_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
     .max_lowres     = 3,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };
 #endif
 #if CONFIG_AMV_DECODER
@@ -121,6 +121,6 @@  AVCodec ff_amv_decoder = {
     .decode         = sp5x_decode_frame,
     .max_lowres     = 3,
     .capabilities   = AV_CODEC_CAP_DR1,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };
 #endif