[FFmpeg-cvslog] riff: Fix potential memleak.

Alex Converse git at videolan.org
Fri Jun 10 04:53:06 CEST 2011


ffmpeg | branch: master | Alex Converse <alex.converse at gmail.com> | Thu Jun  9 09:50:38 2011 -0700| [ed8a50068caacf722b6c7a81f77abcadc134e544] | committer: Alex Converse

riff: Fix potential memleak.

Make ff_get_wav_header() free existing extradata before allocing a new
buffer.

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

 libavformat/riff.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index e17980a..fe6cc55 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -509,6 +509,7 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
         }
         codec->extradata_size = cbSize;
         if (cbSize > 0) {
+            av_free(codec->extradata);
             codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
             if (!codec->extradata)
                 return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list