changeset 110:9fd9b0f9e9d8 libavformat

memleaks
author michaelni
date Sat, 19 Apr 2003 15:48:40 +0000
parents c82a6062485e
children c1e67f7a0168
files avidec.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/avidec.c	Sat Apr 19 15:18:00 2003 +0000
+++ b/avidec.c	Sat Apr 19 15:48:40 2003 +0000
@@ -236,7 +236,7 @@
                     get_le32(pb); /* ClrImportant */
 
                     st->codec.extradata_size= size - 10*4;
-                    st->codec.extradata= av_malloc(st->codec.extradata_size); //FIXME where should we free this?
+                    st->codec.extradata= av_malloc(st->codec.extradata_size);
                     get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
                     
                     if(st->codec.extradata_size & 1) //FIXME check if the encoder really did this correctly
@@ -272,6 +272,7 @@
     /* check stream number */
     if (stream_index != s->nb_streams - 1) {
     fail:
+        av_free(avi->buf);
         for(i=0;i<s->nb_streams;i++) {
             av_freep(&s->streams[i]->codec.extradata);
             av_freep(&s->streams[i]);
@@ -373,6 +374,16 @@
 
 static int avi_read_close(AVFormatContext *s)
 {
+    int i;
+    AVIContext *avi = s->priv_data;
+    av_free(avi->buf);
+
+    for(i=0;i<s->nb_streams;i++) {
+        AVStream *st = s->streams[i];
+//        av_free(st->priv_data);
+        av_free(st->codec.extradata);
+    }
+
     return 0;
 }