Public bug reported:

at line 1879 (with the quilt patchset applied),
nm_gconf_migrate_0_7_ca_cert_ignore calls nm_gconf_get_string_helper,
which causes memory to be allocated for the uuid parameter.

                if (!nm_gconf_get_string_helper (client, dir,
                                                 NM_SETTING_CONNECTION_UUID,
                                                 
NM_SETTING_CONNECTION_SETTING_NAME,
                                                 &uuid))

This memory is never freed. I believe the correct deallocation function
here is g_free, because the allocation is done using g_strdup. Here is a
valgrind log.

==10301== 333 bytes in 9 blocks are definitely lost in loss record 8,678 of 
9,326
==10301==    at 0x4C28FAC: malloc (vg_replace_malloc.c:236)
==10301==    by 0x8F62A62: g_malloc (gmem.c:164)
==10301==    by 0x8F7B06D: g_strdup (gstrfuncs.c:102)
==10301==    by 0x43AF42: nm_gconf_get_string_helper (gconf-helpers.c:200)
==10301==    by 0x443C83: nm_gconf_migrate_0_7_ca_cert_ignore 
(gconf-upgrade.c:1879)
==10301==    by 0x43F85A: nm_gconf_get_all_connections (gconf-helpers.c:1694)
==10301==    by 0x4465A5: read_connections (nma-gconf-settings.c:234)
==10301==    by 0x44665E: list_connections (nma-gconf-settings.c:270)
==10301==    by 0x52701D1: impl_settings_list_connections 
(nm-settings-service.c:107)
==10301==    by 0x526FEBB: 
dbus_glib_marshal_nm_settings_BOOLEAN__POINTER_POINTER (nm-settings-glue.h:97)
==10301==    by 0x6584C4C: ??? (in /usr/lib/libdbus-glib-1.so.2.1.0)
==10301==    by 0x8475A00: _dbus_object_tree_dispatch_and_unlock 
(dbus-object-tree.c:858)
==10301==    by 0x8467B0F: dbus_connection_dispatch (dbus-connection.c:4688)
==10301==    by 0x6582654: ??? (in /usr/lib/libdbus-glib-1.so.2.1.0)
==10301==    by 0x8F5BBCC: g_main_context_dispatch (gmain.c:2440)
==10301==    by 0x8F5C3A7: g_main_context_iterate.clone.6 (gmain.c:3091)
==10301==    by 0x8F5C9F1: g_main_loop_run (gmain.c:3299)
==10301==    by 0x416D77: main (main.c:101)

I think the correct place to call g_free is at the very end of the block
in which uuid is declared, but care must be taken that early outs are
not introduced later. It would probably be a good idea to document the
code block's responsibility to free the uuid.

** Affects: network-manager-applet (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/784756

Title:
  memory leak in nm_gconf_migrate_0_7_ca_cert_ignore

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to