aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-11-24 03:49:55 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-11-24 04:04:39 +0100
commit7c191dfba76ce23e3605d2866f11d5c7ffcafd11 (patch)
tree6fb4c1357fbe8fc4a3e69860c180324c29fd66a1 /libavcodec
parentefb51c8ebbe21f701da816bb78aefc0ce98b378d (diff)
downloadffmpeg-7c191dfba76ce23e3605d2866f11d5c7ffcafd11.tar.gz
avcodec/j2kenc: Only allocate cblk.data once
Fixes: memleak Found-by: <jamrial> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/j2kenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 362c7f0f49..32c7fddb74 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -938,7 +938,8 @@ static int encode_tile(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno
}
}
}
- prec->cblk[cblkno].data = av_malloc(1 + 8192);
+ if (!prec->cblk[cblkno].data)
+ prec->cblk[cblkno].data = av_malloc(1 + 8192);
if (!prec->cblk[cblkno].data)
return AVERROR(ENOMEM);
encode_cblk(s, &t1, prec->cblk + cblkno, tile, xx1 - xx0, yy1 - yy0,