diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-26 22:16:13 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-04 15:46:46 +0100 |
commit | 9de6688cc4216381e155a5b3f7d88c26806db93d (patch) | |
tree | 39a1501cd38c6000f583eb5d70d589bd4b36e411 /libavcodec/mxpegdec.c | |
parent | f3e645a7967d64df8a19c4e0eea93f17937913fb (diff) |
avcodec/mxpegdec: Fix memleaks upon init failure
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/mxpegdec.c')
-rw-r--r-- | libavcodec/mxpegdec.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c index 55ec6e928e..725e435118 100644 --- a/libavcodec/mxpegdec.c +++ b/libavcodec/mxpegdec.c @@ -67,10 +67,8 @@ static av_cold int mxpeg_decode_init(AVCodecContext *avctx) s->picture[0] = av_frame_alloc(); s->picture[1] = av_frame_alloc(); - if (!s->picture[0] || !s->picture[1]) { - mxpeg_decode_end(avctx); + if (!s->picture[0] || !s->picture[1]) return AVERROR(ENOMEM); - } s->jpg.picture_ptr = s->picture[0]; return ff_mjpeg_decode_init(avctx); @@ -351,5 +349,5 @@ AVCodec ff_mxpeg_decoder = { .decode = mxpeg_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, }; |