riff: Fix potential memleak.
Make ff_get_wav_header() free existing extradata before allocing a new buffer.
This commit is contained in:
@@ -509,6 +509,7 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
|
|||||||
}
|
}
|
||||||
codec->extradata_size = cbSize;
|
codec->extradata_size = cbSize;
|
||||||
if (cbSize > 0) {
|
if (cbSize > 0) {
|
||||||
|
av_free(codec->extradata);
|
||||||
codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
if (!codec->extradata)
|
if (!codec->extradata)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
Reference in New Issue
Block a user