ffmpeg | branch: master | Jun Zhao <barryjz...@tencent.com> | Tue Sep 10 
19:39:27 2019 +0800| [3740bdee77ae1810162fc215172f432fcee2d0f0] | committer: 
Michael Niedermayer

lavf/avidec: fix memory leak in error handling path

free the value in error handling path to avoid the memory leak.

Signed-off-by: Jun Zhao <barryjz...@tencent.com>
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3740bdee77ae1810162fc215172f432fcee2d0f0
---

 libavformat/avidec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index df78925d55..e3cd844169 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -306,8 +306,10 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, 
uint32_t tag,
     value = av_malloc(size + 1);
     if (!value)
         return AVERROR(ENOMEM);
-    if (avio_read(pb, value, size) != size)
+    if (avio_read(pb, value, size) != size) {
+        av_freep(&value);
         return AVERROR_INVALIDDATA;
+    }
     value[size] = 0;
 
     AV_WL32(key, tag);

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to