Skip to content

libmm-glib,profile-manager: fix memory leaks when listing connection profiles

This commit fixes memory leaks that occur when invoking mm_modem_3gpp_profile_manager_list function.

When processing the connection profile data retrieved from dbus in build_list_results function, the iterator data (of GVariant type) were not properly freed after use in the while loop.

==7903== 2,697 (144 direct, 2,553 indirect) bytes in 3 blocks are definitely lost in loss record 2,525 of 2,538
==7903==    at 0x484086F: malloc (vg_replace_malloc.c:381)
==7903==    by 0x4A13938: g_malloc (gmem.c:106)
==7903==    by 0x4A2B1F4: g_slice_alloc (gslice.c:1069)
==7903==    by 0x4A51322: UnknownInlinedFun (gvariant-core.c:486)
==7903==    by 0x4A51322: UnknownInlinedFun (gvariant-core.c:624)
==7903==    by 0x4A51322: g_variant_builder_end (gvariant.c:3718)
==7903==    by 0x4C2FEC1: parse_value_from_blob.isra.0 (gdbusmessage.c:1866)
==7903==    by 0x4C2FE8F: parse_value_from_blob.isra.0 (gdbusmessage.c:1766)
==7903==    by 0x4C2FF37: parse_value_from_blob.isra.0 (gdbusmessage.c:1850)
==7903==    by 0x4BF93A7: g_dbus_message_new_from_blob (gdbusmessage.c:2226)
==7903==    by 0x4C09334: _g_dbus_worker_do_read_cb (gdbusprivate.c:750)
==7903==    by 0x4B9EA79: g_task_return_now (gtask.c:1219)
==7903==    by 0x4B9EABC: complete_in_idle_cb (gtask.c:1233)
==7903==    by 0x4A0774A: g_idle_dispatch (gmain.c:5848)
Edited by Louis-Alexis Eyraud

Merge request reports