jpeglsnec: fix memleak of state in error case
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 11 Oct 2012 15:44:58 +0000 (17:44 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 11 Oct 2012 15:44:58 +0000 (17:44 +0200)
Fixes CID733794
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeglsenc.c

index 180f7c9..17fb818 100644 (file)
@@ -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){