mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-06-30 21:08:59 +08:00
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;
|
||||
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);
|
||||
|
Reference in New Issue
Block a user