Ernst Albrecht Köstlin <m...@alks.org> added the comment:

Ok, so I digged deeper and found this is still not all. AVStream's member codec
also need to be freed.

So this should do it:

--- libavformat/ffmdec.c        2010-07-20 21:51:58.000000000 +0200
+++ libavformat/ffmdec_patched.c        2010-07-20 21:49:54.000000000 +0200
@@ -251,6 +251,7 @@
     url_fseek(pb, ptr, SEEK_SET);
 }
 
+static int ffm_close(AVFormatContext *);
 
 static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
@@ -381,12 +382,13 @@
     ffm->first_packet = 1;
     return 0;
  fail:
+    ffm_close(s);
     for(i=0;i<s->nb_streams;i++) {
-        st = s->streams[i];
-        if (st) {
-            av_free(st);
-        }
+        if (s->streams[i])
+            av_freep(&s->streams[i]->codec);
+        av_freep(&s->streams[i]);
     }
+    s->nb_streams = 0;
     return -1;
 }

________________________________________________
FFmpeg issue tracker <iss...@roundup.ffmpeg.org>
<https://roundup.ffmpeg.org/issue2003>
________________________________________________

Reply via email to