[MPlayer-dev-eng] memory leak because of missing demux_close_asf()

Burkhard Fischer b.fi2 at web.de
Sun Oct 1 15:06:26 CEST 2006


Hi Guillaume,

I tested my patch against the current SVN version. The memory leak still 
exists.

Here is my patch (svn diff output):

Index: libmpdemux/demux_asf.c
===================================================================
--- libmpdemux/demux_asf.c	(revision 20011)
+++ libmpdemux/demux_asf.c	(working copy)
@@ -553,6 +553,8 @@
      //---- ASF header:
      if(!asf) return NULL;
      if (!read_asf_header(demuxer,asf)) {
+        if (asf->packet)
+            free(asf->packet);
          free(asf);
          return NULL;
      }
@@ -586,7 +588,15 @@
      return demuxer;
  }

+void demux_close_asf(demuxer_t* demuxer) {
+    struct asf_priv* asf = demuxer->priv;

+    if(!asf) return NULL;
+    if (asf->packet)
+      free(asf->packet);
+    free(asf);
+}
+
  demuxer_desc_t demuxer_desc_asf = {
    "ASF demuxer",
    "asf",
@@ -598,7 +608,7 @@
    asf_check_header,
    demux_asf_fill_buffer,
    demux_open_asf,
-  NULL, //demux_close_asf,
+  demux_close_asf,
    demux_seek_asf,
    demux_asf_control
  };

Bye,
Burkhard

> Please provide a patch against latest SVN. (maybe it's the same code
> as pre8, but anyhow you need to check that...)
> 
> Also, please do not add some cosmetics (i.e. add empty newlines and 
> stuff...)
> 
> Guillaume



More information about the MPlayer-dev-eng mailing list