[FFmpeg-cvslog] avformat/utils: free existing extradata before trying to allocate a new one
James Almer
git at videolan.org
Wed Mar 7 00:15:24 EET 2018
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Mar 6 01:19:13 2018 -0300| [0ca33b1d4eb2a2a2e78ff3a37f1647917635b0d2] | committer: James Almer
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 at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ca33b1d4eb2a2a2e78ff3a37f1647917635b0d2
---
libavformat/utils.c | 1 +
1 file changed, 1 insertion(+)
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;
More information about the ffmpeg-cvslog
mailing list