aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-06 01:19:13 -0300
committerJames Almer <jamrial@gmail.com>2018-03-06 19:13:12 -0300
commit0ca33b1d4eb2a2a2e78ff3a37f1647917635b0d2 (patch)
treec57d973553b0c4d81e6ed96f7ee6db0c61c29afe
parentb19e11a4dc836f4fe87d3e3c25eb5cc4f6f4b447 (diff)
downloadffmpeg-0ca33b1d4eb2a2a2e78ff3a37f1647917635b0d2.tar.gz
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>
-rw-r--r--libavformat/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 72531d4185..31340a484b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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;