aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorBenoit Fouet <benoit.fouet@free.fr>2014-12-03 14:16:56 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-04 00:30:54 +0100
commit6e9b060e4f0c24d2689bebd7fc03e52d75da25b2 (patch)
tree4049b83e58bf79ca9756c7c59826bfe494841c21 /libavcodec
parent08aec6f68e6a3a1e94ce9f08c980987f6eeb9aec (diff)
downloadffmpeg-6e9b060e4f0c24d2689bebd7fc03e52d75da25b2.tar.gz
avcodec/pngdec: fix mem leak in init()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pngdec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index b1e77e5144..3905e0f3bc 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1237,8 +1237,12 @@ static av_cold int png_dec_init(AVCodecContext *avctx)
s->previous_picture.f = av_frame_alloc();
s->last_picture.f = av_frame_alloc();
s->picture.f = av_frame_alloc();
- if (!s->previous_picture.f || !s->last_picture.f || !s->picture.f)
+ if (!s->previous_picture.f || !s->last_picture.f || !s->picture.f) {
+ av_frame_free(&s->previous_picture.f);
+ av_frame_free(&s->last_picture.f);
+ av_frame_free(&s->picture.f);
return AVERROR(ENOMEM);
+ }
if (!avctx->internal->is_copy) {
avctx->internal->allocate_progress = 1;