summaryrefslogtreecommitdiff
path: root/libavcodec/jpeglsenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-11 17:44:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-11 17:44:58 +0200
commit34bbab432ca049ec0a5b9accf6b965b1b1d63b2b (patch)
tree27fc73780e8d47201afb0a40020c5e9461ad0b4f /libavcodec/jpeglsenc.c
parent104b1d9e103f90485e894b20dd5bb3f1964fe5f3 (diff)
downloadffmpeg-34bbab432ca049ec0a5b9accf6b965b1b1d63b2b.tar.gz
jpeglsnec: fix memleak of state in error case
Fixes CID733794 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeglsenc.c')
-rw-r--r--libavcodec/jpeglsenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
index 180f7c905c..17fb8180a7 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){