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 300736 - Plug a bunch of leaks in the registry code
Plug a bunch of leaks in the registry code
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.8.9
Other All
: Normal normal
: 0.8.10
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-04-15 13:01 UTC by Kjartan Maraas
Modified: 2005-04-17 20:43 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
patch for leaks and warnings (4.37 KB, patch)
2005-04-15 15:36 UTC, Kjartan Maraas
none Details | Review
alternative patch (4.38 KB, patch)
2005-04-17 10:04 UTC, Ronald Bultje
none Details | Review
x (3.13 KB, patch)
2005-04-17 10:34 UTC, Ronald Bultje
none Details | Review

Description Kjartan Maraas 2005-04-15 13:01:44 UTC
Attaching a patch. Seems to work with no errors from valgrind at least.
Comment 1 Kjartan Maraas 2005-04-15 13:02:11 UTC
Damn, I need regular CVS access before I can post the patch. Will do so later today
Comment 2 Kjartan Maraas 2005-04-15 15:36:43 UTC
Created attachment 45297 [details] [review]
patch for leaks and warnings
Comment 3 Kjartan Maraas 2005-04-15 15:37:11 UTC
A few gcc4 warnin fixes crept in here too, hope that doesn't cause problems.
Comment 4 Kjartan Maraas 2005-04-15 22:08:41 UTC
There's something not quite right about that patch. It caused totem to segfault
when opening an mpeg file. Attaching backtraces for the leaks that the patch was
supposed to fix, this time from running totem.

==31516== 5769 bytes in 316 blocks are definitely lost in loss record 181 of 206
==31516==    at 0x3414E222: malloc (vg_replace_malloc.c:130)
==31516==    by 0x34927E4E: xmlStrndup (xmlstring.c:45)
==31516==    by 0x34927EAD: xmlStrdup (xmlstring.c:71)
==31516==    by 0x34928536: xmlStrcat (xmlstring.c:519)
==31516==    by 0x348DF659: xmlNodeListGetString (tree.c:1614)
==31516==    by 0x348E25A8: xmlGetProp (tree.c:6045)
==31516==    by 0x34953B37: xmlTextReaderGetAttribute (xmlreader.c:2237)
==31516==    by 0x34392650: load_plugin (gstlibxmlregistry.c:703)
==31516==    by 0x34392E21: gst_xml_registry_load (gstlibxmlregistry.c:922)
==31516==    by 0x3438905B: gst_registry_load (gstregistry.c:125)
==31516==    by 0x34389B55: _registry_load_func (gstregistrypool.c:110)
==31516==    by 0x34CDC953: g_list_foreach (glist.c:670)
==31516==    by 0x34389B7F: gst_registry_pool_load_all (gstregistrypool.c:125)
==31516==    by 0x3434E7B4: init_post (gst.c:638)
==31516==    by 0x3434ED4C: init_popt_callback (gst.c:807)
==31516==    by 0x34C74464: (within /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x34C74478: (within /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x34C74478: (within /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x34C76219: poptGetNextOpt (in /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x342BA170: gnome_program_parse_args (gnome-program.c:1457)
==31516==    by 0x342BA801: gnome_program_init_common (gnome-program.c:1865)
==31516==    by 0x342BAACC: gnome_program_init (gnome-program.c:1684)
==31516==    by 0x805F1D2: main (totem.c:3344)

and another one:

==31516== 1577 (1453 direct, 124 indirect) bytes in 99 blocks are definitely
lost in loss record 162 of 206
==31516==    at 0x3414E222: malloc (vg_replace_malloc.c:130)
==31516==    by 0x34CE5585: g_malloc (gmem.c:137)
==31516==    by 0x34CF5869: g_strdup (gstrfuncs.c:91)
==31516==    by 0x3439238D: read_string (gstlibxmlregistry.c:590)
==31516==    by 0x34392B0F: load_plugin (gstlibxmlregistry.c:759)
==31516==    by 0x34392E21: gst_xml_registry_load (gstlibxmlregistry.c:922)
==31516==    by 0x3438905B: gst_registry_load (gstregistry.c:125)
==31516==    by 0x34389B55: _registry_load_func (gstregistrypool.c:110)
==31516==    by 0x34CDC953: g_list_foreach (glist.c:670)
==31516==    by 0x34389B7F: gst_registry_pool_load_all (gstregistrypool.c:125)
==31516==    by 0x3434E7B4: init_post (gst.c:638)
==31516==    by 0x3434ED4C: init_popt_callback (gst.c:807)
==31516==    by 0x34C74464: (within /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x34C74478: (within /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x34C74478: (within /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x34C76219: poptGetNextOpt (in /usr/lib/libpopt.so.0.0.0)
==31516==    by 0x342BA170: gnome_program_parse_args (gnome-program.c:1457)
==31516==    by 0x342BA801: gnome_program_init_common (gnome-program.c:1865)
==31516==    by 0x342BAACC: gnome_program_init (gnome-program.c:1684)
==31516==    by 0x805F1D2: main (totem.c:3344)
Comment 5 Ronald Bultje 2005-04-17 09:55:46 UTC
You free values added using add_char_array(), whereas that function already
takes ownership of the value. I'm working on a slightly modified patch that uses
a read_string_const(), to prevent excessive malloc/free turns. Not that it
matters much, but hey, if we can, why not just do it.
Comment 6 Ronald Bultje 2005-04-17 10:04:24 UTC
Created attachment 45348 [details] [review]
alternative patch

This seems to work for me. Does it solve all memleaks?
Comment 7 Ronald Bultje 2005-04-17 10:12:04 UTC
Also, please separate the gcc4-patch from the memleak patch, just for my sanity
and yours. :).
Comment 8 Ronald Bultje 2005-04-17 10:28:09 UTC
Hm, the read_const() idea seems to be a bad idea, let me revert that...
Comment 9 Ronald Bultje 2005-04-17 10:34:22 UTC
Created attachment 45350 [details] [review]
x

OK, so this is your original patch w/o the casts and w/o the
free-on-add_to_array.
Comment 10 Ronald Bultje 2005-04-17 20:43:56 UTC
applied, closing. Please file another bug report for the gcc4 stuff so I can do
all that at once.