mirror of https://git.ffmpeg.org/ffmpeg.git
mxg: do not leak mxg->buffer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
db05f7ab16
commit
a72b41035c
|
@ -101,17 +101,19 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size)
|
||||||
MXGContext *mxg = s->priv_data;
|
MXGContext *mxg = s->priv_data;
|
||||||
unsigned int current_pos = mxg->buffer_ptr - mxg->buffer;
|
unsigned int current_pos = mxg->buffer_ptr - mxg->buffer;
|
||||||
unsigned int soi_pos;
|
unsigned int soi_pos;
|
||||||
|
uint8_t *buffer;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* reallocate internal buffer */
|
/* reallocate internal buffer */
|
||||||
if (current_pos > current_pos + cache_size)
|
if (current_pos > current_pos + cache_size)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
soi_pos = mxg->soi_ptr - mxg->buffer;
|
soi_pos = mxg->soi_ptr - mxg->buffer;
|
||||||
mxg->buffer = av_fast_realloc(mxg->buffer, &mxg->buffer_size,
|
buffer = av_fast_realloc(mxg->buffer, &mxg->buffer_size,
|
||||||
current_pos + cache_size +
|
current_pos + cache_size +
|
||||||
FF_INPUT_BUFFER_PADDING_SIZE);
|
FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
if (!mxg->buffer)
|
if (!buffer)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
mxg->buffer = buffer;
|
||||||
mxg->buffer_ptr = mxg->buffer + current_pos;
|
mxg->buffer_ptr = mxg->buffer + current_pos;
|
||||||
if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos;
|
if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue