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

Oded Shimon ods15 at ods15.dyndns.org
Sun Oct 1 16:00:28 CEST 2006


On Sun, Oct 01, 2006 at 03:06:26PM +0200, Burkhard Fischer 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);

useless if before a free()

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

jusr 'return;', this is a void function.

> +    if (asf->packet)
> +      free(asf->packet);

again, useless if.

> +    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,

Patch seems ok otherwise (indentation whatever?)

- ods15



More information about the MPlayer-dev-eng mailing list