diff mbox

[FFmpeg-devel,V2] lavf/4xm: fix memory leak in error handing path

Message ID 1569256764-4708-1-git-send-email-mypopydev@gmail.com
State Accepted
Commit 5f13859873a45424a345186e8b9913a8c4cb834f
Headers show

Commit Message

Jun Zhao Sept. 23, 2019, 4:39 p.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

need to free the header in error path.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavformat/4xm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Michael Niedermayer Sept. 24, 2019, 8:21 p.m. UTC | #1
On Tue, Sep 24, 2019 at 12:39:24AM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> need to free the header in error path.
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavformat/4xm.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

LGTM

thx

[...]
mypopy@gmail.com Sept. 25, 2019, 3:24 a.m. UTC | #2
On Wed, Sep 25, 2019 at 4:21 AM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Tue, Sep 24, 2019 at 12:39:24AM +0800, Jun Zhao wrote:
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > need to free the header in error path.
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavformat/4xm.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
>
> LGTM
>
> thx
>
Pushed, thx
diff mbox

Patch

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index a984fc9..a6101a9 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -241,7 +241,8 @@  static int fourxm_read_header(AVFormatContext *s)
         size       = AV_RL32(&header[i + 4]);
         if (size > header_size - i - 8 && (fourcc_tag == vtrk_TAG || fourcc_tag == strk_TAG)) {
             av_log(s, AV_LOG_ERROR, "chunk larger than array %d>%d\n", size, header_size - i - 8);
-            return AVERROR_INVALIDDATA;
+            ret = AVERROR_INVALIDDATA;
+            goto fail;
         }
 
         if (fourcc_tag == std__TAG) {