[FFmpeg-devel] [PATCH] avidec: fix leaking extradata

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Nov 29 01:33:17 EET 2016


Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/avidec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index e5a292e..97dbeae 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -770,6 +770,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
                             st->codecpar->extradata_size = esize - 10 * 4;
                         } else
                             st->codecpar->extradata_size =  size - 10 * 4;
+                        av_freep(&st->codecpar->extradata);
                         if (ff_get_extradata(s, st->codecpar, pb, st->codecpar->extradata_size) < 0)
                             return AVERROR(ENOMEM);
                     }
@@ -925,6 +926,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 st = s->streams[stream_index];
 
                 if (size<(1<<30)) {
+                    av_freep(&st->codecpar->extradata);
                     if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
                         return AVERROR(ENOMEM);
                 }
-- 
2.10.2


More information about the ffmpeg-devel mailing list