summaryrefslogtreecommitdiff
path: root/libavformat/riff.c
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2011-06-09 09:50:38 -0700
committerAlex Converse <alex.converse@gmail.com>2011-06-09 10:12:50 -0700
commited8a50068caacf722b6c7a81f77abcadc134e544 (patch)
treecc5e542b5b0b7eb0ed4fd0d8cacd46eccdc3dbe7 /libavformat/riff.c
parentdbd3183935e252aaf5796638d4711cff27c75934 (diff)
riff: Fix potential memleak.
Make ff_get_wav_header() free existing extradata before allocing a new buffer.
Diffstat (limited to 'libavformat/riff.c')
-rw-r--r--libavformat/riff.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c
index e17980a00a..fe6cc55055 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);