[FFmpeg-cvslog] jpeglsnec: fix memleak of state in error case

Michael Niedermayer git at videolan.org
Thu Oct 11 18:07:46 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 11 17:44:58 2012 +0200| [34bbab432ca049ec0a5b9accf6b965b1b1d63b2b] | committer: Michael Niedermayer

jpeglsnec: fix memleak of state in error case

Fixes CID733794
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34bbab432ca049ec0a5b9accf6b965b1b1d63b2b
---

 libavcodec/jpeglsenc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
index 180f7c9..17fb818 100644
--- a/libavcodec/jpeglsenc.c
+++ b/libavcodec/jpeglsenc.c
@@ -293,8 +293,10 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
     ls_store_lse(state, &pb);
 
     zero = av_mallocz(FFABS(p->linesize[0]));
-    if (!zero)
+    if (!zero) {
+        av_free(state);
         return AVERROR(ENOMEM);
+    }
     last = zero;
     cur = p->data[0];
     if(avctx->pix_fmt == AV_PIX_FMT_GRAY8){



More information about the ffmpeg-cvslog mailing list