[FFmpeg-cvslog] avidec: fix leaking extradata

Andreas Cadhalpun git at videolan.org
Wed Nov 30 03:23:46 EET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Tue Nov 29 00:28:55 2016 +0100| [2c908f22c2af0775a6ffe3466aad174a0ace00dd] | committer: Andreas Cadhalpun

avidec: fix leaking extradata

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c908f22c2af0775a6ffe3466aad174a0ace00dd
---

 libavformat/avidec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index e5a292e..d465965 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -770,6 +770,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
                             st->codecpar->extradata_size = esize - 10 * 4;
                         } else
                             st->codecpar->extradata_size =  size - 10 * 4;
+                        if (st->codecpar->extradata) {
+                            av_log(s, AV_LOG_WARNING, "New extradata in strf chunk, freeing previous one.\n");
+                            av_freep(&st->codecpar->extradata);
+                        }
                         if (ff_get_extradata(s, st->codecpar, pb, st->codecpar->extradata_size) < 0)
                             return AVERROR(ENOMEM);
                     }
@@ -925,6 +929,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 st = s->streams[stream_index];
 
                 if (size<(1<<30)) {
+                    if (st->codecpar->extradata) {
+                        av_log(s, AV_LOG_WARNING, "New extradata in strd chunk, freeing previous one.\n");
+                        av_freep(&st->codecpar->extradata);
+                    }
                     if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
                         return AVERROR(ENOMEM);
                 }



More information about the ffmpeg-cvslog mailing list