diff mbox

[FFmpeg-devel,ogm] Free extradata before reallocating.

Message ID CAPUDrwfCW=aVPtqmaOxqYZTJ+0MZmSUus501fUBvn=O1+KV-Yg@mail.gmail.com
State New
Headers show

Commit Message

Dale Curtis Nov. 21, 2017, 11:12 p.m. UTC
Otherwise ff_alloc_extradata() just leaks any existing allocated
memory.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>

Comments

Dale Curtis Nov. 27, 2017, 10:49 p.m. UTC | #1
Ping?

On Tue, Nov 21, 2017 at 3:12 PM, Dale Curtis <dalecurtis@chromium.org>
wrote:

> Otherwise ff_alloc_extradata() just leaks any existing allocated
> memory.
>
> Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
>
>
Derek Buitenhuis Nov. 28, 2017, 12:03 a.m. UTC | #2
On 11/21/2017 11:12 PM, Dale Curtis wrote:
> Otherwise ff_alloc_extradata() just leaks any existing allocated
> memory.

Should be OK.

- Derek
Michael Niedermayer Nov. 28, 2017, 12:44 a.m. UTC | #3
On Tue, Nov 28, 2017 at 12:03:38AM +0000, Derek Buitenhuis wrote:
> On 11/21/2017 11:12 PM, Dale Curtis wrote:
> > Otherwise ff_alloc_extradata() just leaks any existing allocated
> > memory.
> 
> Should be OK.

will apply
i had tested this one already a bit a few days ago ...

thx
[...]
diff mbox

Patch

From 15db35021f026296aba46699cc282d77bd1d295e Mon Sep 17 00:00:00 2001
From: Dale Curtis <dalecurtis@chromium.org>
Date: Tue, 21 Nov 2017 15:10:08 -0800
Subject: [PATCH] [ogm] Free extradata before reallocating.

Otherwise ff_alloc_extradata() just leaks any existing allocated
memory.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
---
 libavformat/oggparseogm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c
index e7a501b5a7..fad093b629 100644
--- a/libavformat/oggparseogm.c
+++ b/libavformat/oggparseogm.c
@@ -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);
-- 
2.15.0.448.gf294e3d99a-goog