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

Guillaume POIRIER poirierg at gmail.com
Sun Oct 1 15:33:06 CEST 2006


Hi,

On 10/1/06, Burkhard Fischer <b.fi2 at web.de> wrote:
> 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
>   };

His patch looks quite clean, so I'm quite tempted to apply it, unless
someone disagrees.

Guillaume
-- 
With DADVSI (http://en.wikipedia.org/wiki/DADVSI), France finally has
a lead on USA on selling out individuals right to corporations!
Vive la France!



More information about the MPlayer-dev-eng mailing list