[MPlayer-dev-eng] memory leak in the libaf/af.c

Andrew Savchenko Bircoph at list.ru
Sat Feb 10 14:43:35 CET 2007


On 10 Feb 2007 03:43 Uoti Urpala wrote:
[...]
> Yes it is silly. First, free(NULL) is valid (no-op) so the test
> is useless. Second, af is a local variable so changing it before
> returning is also useless. Third, the patch was wrong anyway.

You're write. First patch was absolutely wrong, but problem exists.
There are 2 places where pointers are initialized and not freed at 
filter uninit.

1st: af.c, af_resize_local_buffer():
af->data->audio = malloc(len);

2nd: af_lavcresample.c, af_data_t* play():
      for(i=0; i<chans; i++){
          s->in[i]= realloc(s->in[i], 
s->in_alloc*sizeof(int16_t)); //FIXME free this maybe ;)

I modified uninit() function to free them if necessary. Please 
review the patch. Is it ok for you?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070210/968ee7ce/attachment.pgp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: af_lavcresample.c.memleak_fix.patch
Type: text/x-diff
Size: 586 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070210/968ee7ce/attachment.patch>


More information about the MPlayer-dev-eng mailing list