GNOME Bugzilla – Bug 150707
Leaks and invalid reads reported by valgrind
Last modified: 2005-06-18 01:32:07 UTC
I see this output from valgrind after a short run: ==29927== 6 errors in context 5 of 15: ==29927== Invalid read of size 4 ==29927== at 0x805418F: weather_location_equal (weather.c:215) ==29927== by 0x8059B4D: ??? (gweather-xml.c:287) ==29927== by 0x8059EF2: ??? (gweather-xml.c:357) ==29927== by 0x8059E31: ??? (gweather-xml.c:349) ==29927== by 0x8059EA5: ??? (gweather-xml.c:352) ==29927== by 0x805A1CA: gweather_xml_load_locations (gweather-xml.c:401) ==29927== by 0x80505EE: gweather_pref_run (gweather-pref.c:356) ==29927== by 0x491DF9: (within /usr/lib/libbonoboui-2.so.0.0.0) ==29927== by 0xD46346: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0x73B3317: bonobo_closure_invoke_va_list (in /usr/lib/libbonobo-2.so.0.0.0) Leaks follow: ==29927== 44 bytes in 2 blocks are definitely lost in loss record 47 of 201 ==29927== at 0x1B902A9C: malloc (vg_replace_malloc.c:131) ==29927== by 0xCC9922: g_malloc (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0xCD82A5: g_strdup (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x42AE58: gnome_program_locate_file (in /usr/lib/libgnome-2.so.0.702.0) ==29927== by 0x8059F6D: gweather_xml_load_locations (gweather-xml.c:429) ==29927== by 0x80505EE: gweather_pref_run (gweather-pref.c:356) ==29927== by 0x491DF9: (within /usr/lib/libbonoboui-2.so.0.0.0) ==29927== by 0xD46346: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0x73B3317: bonobo_closure_invoke_va_list (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x73B3584: bonobo_closure_invoke (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x4930A1: (within /usr/lib/libbonoboui-2.so.0.0.0) ==29927== by 0x73B4352: _ORBIT_skel_small_Bonobo_UIComponent_execVerb (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x732A13C: ORBit_c_stub_invoke (in /usr/lib/libORBit-2.so.0.0.0) ==29927== by 0x73B7FA1: Bonobo_UIComponent_execVerb (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x49C29F: (within /usr/lib/libbonoboui-2.so.0.0.0) ==29927== by 0xD5EB85: g_cclosure_marshal_VOID__POINTER (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD466B1: (within /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD46346: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD5C575: (within /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD5D9BB: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== ==29927== ==29927== 60 bytes in 6 blocks are definitely lost in loss record 59 of 201 ==29927== at 0x1B903419: calloc (vg_replace_malloc.c:176) ==29927== by 0xCC998F: g_malloc0 (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x1C0E2D5A: ??? (http-neon-method.c:1356) ==29927== by 0x1C0E30B2: ??? (http-neon-method.c:1558) ==29927== by 0x1C0E3A61: ??? (http-neon-method.c:2032) ==29927== by 0x1C0E3F41: ??? (http-neon-method.c:2257) ==29927== by 0x73FD271: gnome_vfs_open_uri_cancellable (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x740B9FD: _gnome_vfs_job_execute (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x7409B85: (within /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x741B11C: (within /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0xCDD5C1: (within /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x1B929825: thread_wrapper (vg_libpthread.c:867) ==29927== by 0xB000F088: do__quit (vg_scheduler.c:1863) ==29927== ==29927== ==29927== 136 bytes in 2 blocks are possibly lost in loss record 75 of 201 ==29927== at 0x1B903419: calloc (vg_replace_malloc.c:176) ==29927== by 0x1B8F20F5: __GI__dl_allocate_tls (in /lib/ld-2.3.3.so) ==29927== by 0x1B92A513: pthread_create (vg_libpthread.c:1155) ==29927== by 0x8B6985: (within /usr/lib/libgthread-2.0.so.0.400.6) ==29927== by 0xCDDBA5: g_thread_create_full (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x741B3E3: _gnome_vfs_thread_create (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x7409C6F: _gnome_vfs_job_create_slave (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x7409881: _gnome_vfs_job_schedule (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x740A6EB: _gnome_vfs_job_go (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x73FB701: (within /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x73FB8FD: gnome_vfs_async_open (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x8057747: _weather_info_fill (weather.c:1765) ==29927== by 0x8053B55: gweather_update (gweather-applet.c:495) ==29927== by 0x804D669: gweather_applet_new (main.c:40) ==29927== by 0x120639: panel_applet_marshal_BOOLEAN__STRING (in /usr/lib/libpanel-applet-2.so.0.0.19) ==29927== by 0xD46346: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0x73B3317: bonobo_closure_invoke_va_list (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x73B3584: bonobo_closure_invoke (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x11D38E: (within /usr/lib/libpanel-applet-2.so.0.0.19) ==29927== by 0xD5E0AD: g_cclosure_marshal_VOID__VOID (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== ==29927== ==29927== 152 bytes in 10 blocks are possibly lost in loss record 78 of 201 ==29927== at 0x1B902A9C: malloc (vg_replace_malloc.c:131) ==29927== by 0xCC9922: g_malloc (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x731C5E0: ORBit_alloc_string (in /usr/lib/libORBit-2.so.0.0.0) ==29927== by 0x731C131: CORBA_string_dup (in /usr/lib/libORBit-2.so.0.0.0) ==29927== by 0x6430A7: Bonobo_ActivationEnvValue_set (in /usr/lib/libbonobo-activation.so.4.0.0) ==29927== by 0x641AE2: bonobo_activation_init_activation_env (in /usr/lib/libbonobo-activation.so.4.0.0) ==29927== by 0x644B82: bonobo_activation_orb_init (in /usr/lib/libbonobo-activation.so.4.0.0) ==29927== by 0x42F802: (within /usr/lib/libgnome-2.so.0.702.0) ==29927== by 0x42BEDD: gnome_program_postinit (in /usr/lib/libgnome-2.so.0.702.0) ==29927== by 0x42C285: (within /usr/lib/libgnome-2.so.0.702.0) ==29927== by 0x42C5BE: gnome_program_init (in /usr/lib/libgnome-2.so.0.702.0) ==29927== by 0x804D741: main (main.c:57) ==29927== ==29927== ==29927== 160 bytes in 4 blocks are definitely lost in loss record 81 of 201 ==29927== at 0x1B903506: realloc (vg_replace_malloc.c:197) ==29927== by 0xCC99FB: g_realloc (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0xCDB30B: (within /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0xCDB87D: g_string_insert_len (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0xCDBC5B: g_string_append (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x741CBC6: gnome_vfs_uri_to_string (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x1C0E312D: ??? (http-neon-method.c:1589) ==29927== by 0x1C0E31F2: ??? (http-neon-method.c:1615) ==29927== by 0x1C0E3954: ??? (http-neon-method.c:1983) ==29927== by 0x1C0E3EDF: ??? (http-neon-method.c:2215) ==29927== by 0x73FD271: gnome_vfs_open_uri_cancellable (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x740B9FD: _gnome_vfs_job_execute (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x7409B85: (within /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x741B11C: (within /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0xCDD5C1: (within /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x1B929825: thread_wrapper (vg_libpthread.c:867) ==29927== by 0xB000F088: do__quit (vg_scheduler.c:1863) ==29927== ==29927== ==29927== 1596 bytes in 45 blocks are possibly lost in loss record 150 of 201 ==29927== at 0x1B903419: calloc (vg_replace_malloc.c:176) ==29927== by 0xCC998F: g_malloc0 (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0xD5F3DD: (within /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD5F6A5: (within /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD68A6C: g_type_init_with_debug_flags (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD68BC1: g_type_init (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0x42C583: gnome_program_init (in /usr/lib/libgnome-2.so.0.702.0) ==29927== by 0x804D741: main (main.c:57) ==29927== ==29927== ==29927== 2464 bytes in 2 blocks are possibly lost in loss record 164 of 201 ==29927== at 0x1B9035D1: memalign (vg_replace_malloc.c:217) ==29927== by 0x1B8F20AD: __GI__dl_allocate_tls (in /lib/ld-2.3.3.so) ==29927== by 0x1B92A513: pthread_create (vg_libpthread.c:1155) ==29927== by 0x8B6985: (within /usr/lib/libgthread-2.0.so.0.400.6) ==29927== by 0xCDDBA5: g_thread_create_full (in /usr/lib/libglib-2.0.so.0.400.6) ==29927== by 0x741B3E3: _gnome_vfs_thread_create (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x7409C6F: _gnome_vfs_job_create_slave (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x7409881: _gnome_vfs_job_schedule (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x740A6EB: _gnome_vfs_job_go (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x73FB701: (within /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x73FB8FD: gnome_vfs_async_open (in /usr/lib/libgnomevfs-2.so.0.791.0) ==29927== by 0x8057689: _weather_info_fill (weather.c:1089) ==29927== by 0x8053B55: gweather_update (gweather-applet.c:495) ==29927== by 0x804D669: gweather_applet_new (main.c:40) ==29927== by 0x120639: panel_applet_marshal_BOOLEAN__STRING (in /usr/lib/libpanel-applet-2.so.0.0.19) ==29927== by 0xD46346: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0x73B3317: bonobo_closure_invoke_va_list (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x73B3584: bonobo_closure_invoke (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x11D38E: (within /usr/lib/libpanel-applet-2.so.0.0.19) ==29927== by 0xD5E0AD: g_cclosure_marshal_VOID__VOID (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== ==29927== ==29927== 3616 bytes in 359 blocks are definitely lost in loss record 168 of 201 ==29927== at 0x1B902A9C: malloc (vg_replace_malloc.c:131) ==29927== by 0x7ABC648: xmlStrndup (in /usr/lib/libxml2.so.2.6.11) ==29927== by 0x7ABC6B3: xmlStrdup (in /usr/lib/libxml2.so.2.6.11) ==29927== by 0x7A91348: xmlTextReaderValue (in /usr/lib/libxml2.so.2.6.11) ==29927== by 0x80599D1: ??? (gweather-xml.c:183) ==29927== by 0x8059E76: ??? (gweather-xml.c:345) ==29927== by 0x8059EA5: ??? (gweather-xml.c:352) ==29927== by 0x805A1CA: gweather_xml_load_locations (gweather-xml.c:401) ==29927== by 0x80505EE: gweather_pref_run (gweather-pref.c:356) ==29927== by 0x491DF9: (within /usr/lib/libbonoboui-2.so.0.0.0) ==29927== by 0xD46346: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0x73B3317: bonobo_closure_invoke_va_list (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x73B3584: bonobo_closure_invoke (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x4930A1: (within /usr/lib/libbonoboui-2.so.0.0.0) ==29927== by 0x73B4352: _ORBIT_skel_small_Bonobo_UIComponent_execVerb (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x732A13C: ORBit_c_stub_invoke (in /usr/lib/libORBit-2.so.0.0.0) ==29927== by 0x73B7FA1: Bonobo_UIComponent_execVerb (in /usr/lib/libbonobo-2.so.0.0.0) ==29927== by 0x49C29F: (within /usr/lib/libbonoboui-2.so.0.0.0) ==29927== by 0xD5EB85: g_cclosure_marshal_VOID__POINTER (in /usr/lib/libgobject-2.0.so.0.400.6) ==29927== by 0xD466B1: (within /usr/lib/libgobject-2.0.so.0.400.6) ==29927== ==29927== LEAK SUMMARY: ==29927== definitely lost: 3880 bytes in 371 blocks. ==29927== possibly lost: 4348 bytes in 59 blocks. ==29927== still reachable: 2286134 bytes in 45743 blocks. ==29927== suppressed: 600 bytes in 3 blocks. ==29927== Reachable blocks (those to which a pointer was found) are not shown. ==29927== To see them, rerun with: --show-reachable=yes --29927-- TT/TC: 0 tc sectors discarded. --29927-- 751898 tt_fast misses. --29927-- translate: new 93294 (1446305 -> 19151557; ratio 132:10) --29927-- discard 389 (5920 -> 77612; ratio 131:10). --29927-- chainings: 72514 chainings, 2 unchainings. --29927-- dispatch: 283850000 jumps (bb entries); of them 71479467 (25%) unchained. --29927-- 16291/6685050 major/minor sched events. --29927-- reg-alloc: 15275 t-req-spill, 3518342+115968 orig+spill uis, --29927-- 474518 total-reg-rank --29927-- sanity: 15478 cheap, 620 expensive checks. --29927-- ccalls: 369885 C calls, 57% saves+restores avoided (1259018 bytes) --29927-- 512641 args, avg 0.90 setup instrs each (97890 bytes) --29927-- 0% clear the stack (1108812 bytes) --29927-- 129259 retvals, 34% of reg-reg movs avoided (86636 bytes) [kmaraas@home kmaraas]$
The code in this section is very hard to understand, however a source of leaks could be from the use of xmlTextReaderValue (which needs to be deallocated with xmlFree()).
The http-neon-method.c related leaks are already fixed. The main thing here is to get rid of the memory management bugs in gweather-xml.c
Can these be rechecked against HEAD? Some of these leaks are meant to be plugged now.
/me pokes Kjartan...
I'll get on it. Sorry for being lazy :)
gweather-xml.c was almost entirely rewritten since this report and I've valgrinded open/closing the preferences dialog a few times and can see no leaks in the current code.