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

Jun Zhao mypopydev at gmail.com
Mon Sep 23 19:39:24 EEST 2019


From: Jun Zhao <barryjzhao at tencent.com>

need to free the header in error path.

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

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) {
-- 
1.7.1



More information about the ffmpeg-devel mailing list