After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 159215 - [PATCH] Memory leaks in audioscale
[PATCH] Memory leaks in audioscale
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
0.8.5
Other Linux
: Normal normal
: 0.8.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-11-23 16:32 UTC by Sebastien Cote
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
leak fix (1.36 KB, patch)
2004-12-11 03:43 UTC, Sebastien Cote
none Details | Review

Description Sebastien Cote 2004-11-23 16:32:04 UTC
audioscale leaks a lot because of libresample. Here'a a valgrind log (running a
pipeline twice):

==20423== 5952 bytes in 2 blocks are possibly lost in loss record 22 of 28
==20423==    at 0x1B9069FF: realloc (vg_replace_malloc.c:197)
==20423==    by 0x1C12C374: gst_resample_sinc_ft_s16 (resample.c:498)
==20423==    by 0x1C12B90D: gst_resample_scale (resample.c:211)
==20423==    by 0x1C1257D6: gst_audioscale_chain (gstaudioscale.c:656)
==20423==
==20423==
==20423== 9216 bytes in 2 blocks are definitely lost in loss record 23 of 28
==20423==    at 0x1B905EDD: malloc (vg_replace_malloc.c:131)
==20423==    by 0x1C12B7E3: gst_resample_scale (resample.c:187)
==20423==    by 0x1C1257D6: gst_audioscale_chain (gstaudioscale.c:656)
==20423==    by 0x1B94BF63: gst_pad_call_chain_function (gstpad.c:4402)
Comment 1 Sebastien Cote 2004-11-24 14:53:41 UTC
I added the following code to resample.c

void
gst_resample_close (gst_resample_t * r)
{
  if (r->buffer) {
    free (r->buffer);
    r->buffer = NULL;
    r->buffer_len = 0;
  }
  if (r->hack_union.s.out_tmp) {
    free (r->hack_union.s.out_tmp);
    r->hack_union.s.out_tmp = NULL;
    r->hack_union.s.out_tmp_len = 0;
  }
  
}

Calling this function from audioscale's dispose method gets rid of the memory
leaks. 
Comment 2 Ronald Bultje 2004-12-01 13:24:34 UTC
Sebastien, can you attach that as a patch? Thanks.
Comment 3 Sebastien Cote 2004-12-11 03:43:43 UTC
Created attachment 34726 [details] [review]
leak fix

Adds function gst_resample_close() to libresample which is called in
audioscale's dispose().

The patch has been created and tested with gst-plugins-0.8.5 but it applies
correctly against gst-plugins-0.8.6.
Comment 4 Christian Fredrik Kalager Schaller 2004-12-12 12:14:24 UTC
Setting milestone on this so that thomas or ronald will be sure to review it
before next release
Comment 5 Ronald Bultje 2004-12-16 11:38:44 UTC
Applied to CVS, thanks.