Free extradata before reallocating.
authorDale Curtis <dalecurtis@chromium.org>
Tue, 21 Nov 2017 23:10:08 +0000 (15:10 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 28 Nov 2017 20:42:48 +0000 (21:42 +0100)
Otherwise ff_alloc_extradata() just leaks any existing allocated
memory.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/oggparseogm.c

index e7a501b..fad093b 100644 (file)
@@ -110,6 +110,7 @@ ogm_header(AVFormatContext *s, int idx)
                 size -= 52;
                 if (bytestream2_get_bytes_left(&p) < size)
                     return AVERROR_INVALIDDATA;
+                av_freep(&st->codecpar->extradata);
                 if (ff_alloc_extradata(st->codecpar, size) < 0)
                     return AVERROR(ENOMEM);
                 bytestream2_get_buffer(&p, st->codecpar->extradata, st->codecpar->extradata_size);