[FFmpeg-cvslog] avformat/wc3movie: fix memleak when read content size not equvipe input size

Steven Liu git at videolan.org
Mon Oct 28 08:28:45 EET 2019


ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Thu Oct 10 10:07:56 2019 +0800| [68f623d64451a6ee8c81b6071ec68d6097c0f213] | committer: Steven Liu

avformat/wc3movie: fix memleak when read content size not equvipe input size

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>

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

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

diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 27f5eb1962..6577007777 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -130,8 +130,10 @@ static int wc3_read_header(AVFormatContext *s)
             buffer = av_malloc(size+1);
             if (!buffer)
                 return AVERROR(ENOMEM);
-            if ((ret = avio_read(pb, buffer, size)) != size)
+            if ((ret = avio_read(pb, buffer, size)) != size) {
+                av_freep(&buffer);
                 return AVERROR(EIO);
+            }
             buffer[size] = 0;
             av_dict_set(&s->metadata, "title", buffer,
                                    AV_DICT_DONT_STRDUP_VAL);



More information about the ffmpeg-cvslog mailing list