[FFmpeg-devel] avformat/mov: add free memory when error

Submitted by darling.zhong on Nov. 7, 2019, 12:54 p.m.

Details

Message ID 3018e68d.ed84b.16e45ee9bc3.Coremail.dalingzhong@yeah.net
State New
Headers show

Commit Message

darling.zhong Nov. 7, 2019, 12:54 p.m.
Here may have a mem leak when error


Signed-off-by: darling.zhong <dalingzhong@yeah.net>
---
 libavformat/mov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 libavformat/mov.c

Patch hide | download patch | download mbox

diff --git a/libavformat/mov.c b/libavformat/mov.c
old mode 100644
new mode 100755
index 4f69664eaf..c2e42ea747
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1327,8 +1327,10 @@  static int update_frag_index(MOVContext *c, int64_t offset)
 
     for (i = 0; i < c->fc->nb_streams; i++) {
         // Avoid building frag index if streams lack track id.
-        if (c->fc->streams[i]->id < 0)
+        if (c->fc->streams[i]->id < 0) {
+            av_free(frag_stream_info);
             return AVERROR_INVALIDDATA;
+        }
 
         frag_stream_info[i].id = c->fc->streams[i]->id;
         frag_stream_info[i].sidx_pts = AV_NOPTS_VALUE;