[MPlayer-dev-eng] memory leak in the libaf/af.c
Guillaume POIRIER
poirierg at gmail.com
Sat Feb 10 01:34:54 CET 2007
Hi,
On 2/10/07, Andrew Savchenko <Bircoph at list.ru> wrote:
> Hello,
>
> In function af_data_t* af_play() (libaf/af.c, line 507)
> af pointer is initialized (af_instance_t* af=s->first;) but it is
> not freed anywhere. This memory leak is confirmed with valgrind
> and occurs when seeking to another file in playlist.
>
> Obvious patch seems to fix this. Please review.
--- mplayer/libaf/af.c.old 2006-11-09 18:18:43.000000000 +0300
+++ mplayer/libaf/af.c 2007-02-10 03:13:58.000000000 +0300
@@ -513,6 +513,7 @@
data=af->play(af,data);
af=af->next;
}while(af);
+ free(af);
return data;
}
This is maybe silly for me to say that, but wouldn't it be better to write:
data=af->play(af,data);
af=af->next;
}while(af);
+ if (af) {
+ free(af);
+ af=NULL;
+ }
return data;
}
Guillaume
More information about the MPlayer-dev-eng
mailing list