Commit 5acef120 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

avformat/bethsoftvid: Fix potential memleak upon reallocation failure

The classical ptr = av_realloc(ptr, size), just with av_fast_realloc().
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6e14ddd1
......@@ -147,9 +147,13 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
}
do{
vidbuf_start = av_fast_realloc(vidbuf_start, &vidbuf_capacity, vidbuf_nbytes + BUFFER_PADDING_SIZE);
if(!vidbuf_start)
return AVERROR(ENOMEM);
uint8_t *tmp = av_fast_realloc(vidbuf_start, &vidbuf_capacity,
vidbuf_nbytes + BUFFER_PADDING_SIZE);
if (!tmp) {
ret = AVERROR(ENOMEM);
goto fail;
}
vidbuf_start = tmp;
code = avio_r8(pb);
vidbuf_start[vidbuf_nbytes++] = code;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment