Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com>
---
 libavcodec/smvjpegdec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index 69327cd..261a441 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -89,8 +89,10 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
 
     s->picture[1] = av_frame_alloc();
-    if (!s->picture[1])
+    if (!s->picture[1]) {
+        av_frame_free(&s->picture[0]);
         return AVERROR(ENOMEM);
+    }
 
     s->jpg.picture_ptr      = s->picture[0];
 
@@ -120,6 +122,11 @@ static av_cold int smvjpeg_decode_init(AVCodecContext 
*avctx)
     }
     av_dict_free(&thread_opt);
 
+    if (ret < 0) {
+        av_frame_free(&s->picture[0]);
+        av_frame_free(&s->picture[1]);
+        avcodec_free_context(&s->avctx);
+    }
     return ret;
 }
 
-- 
1.9.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to