Make ff_get_wav_header() free existing extradata before allocing a new
buffer.
---
 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);
-- 
1.7.3.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to