Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-11-24 05:49:55 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-11-24 06:04:39 +0300
commit7c191dfba76ce23e3605d2866f11d5c7ffcafd11 (patch)
tree6fb4c1357fbe8fc4a3e69860c180324c29fd66a1
parentefb51c8ebbe21f701da816bb78aefc0ce98b378d (diff)
avcodec/j2kenc: Only allocate cblk.data once
Fixes: memleak Found-by: <jamrial> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-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,