1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00

avformat/utils: free existing extradata before trying to allocate a new one

This prevents leaks in the rare cases the function is called when extradata
already exists.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2018-03-06 01:19:13 -03:00
parent b19e11a4dc
commit 0ca33b1d4e

View File

@ -3245,6 +3245,7 @@ int ff_alloc_extradata(AVCodecParameters *par, int size)
{
int ret;
av_freep(&par->extradata);
if (size < 0 || size >= INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
par->extradata = NULL;
par->extradata_size = 0;