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:
parent
b19e11a4dc
commit
0ca33b1d4e
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user