aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib
diff options
context:
space:
mode:
authorLouis-Alexis Eyraud <louis-alexis.eyraud@unabiz.com>2022-08-09 14:53:34 +0200
committerLouis-Alexis Eyraud <louis-alexis.eyraud@unabiz.com>2022-08-09 14:53:34 +0200
commita97b58ebf742c3bae4fab73d66f35c959ddc0639 (patch)
treeca8f3da478cc3f9963c7c8e214d3534ccfb3f750 /libmm-glib
parentc6921421dada7ec118211b4c995e191952feae18 (diff)
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) Signed-off-by: Louis-Alexis Eyraud <louis-alexis.eyraud@unabiz.com>
Diffstat (limited to 'libmm-glib')
-rw-r--r--libmm-glib/mm-modem-3gpp-profile-manager.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libmm-glib/mm-modem-3gpp-profile-manager.c b/libmm-glib/mm-modem-3gpp-profile-manager.c
index 67ae2928..29cf1cfe 100644
--- a/libmm-glib/mm-modem-3gpp-profile-manager.c
+++ b/libmm-glib/mm-modem-3gpp-profile-manager.c
@@ -154,7 +154,7 @@ build_list_results (GVariant *dictionaries,
n = g_variant_iter_n_children (&iter);
if (n > 0) {
- g_autoptr(GVariant) dictionary = NULL;
+ GVariant* dictionary = NULL;
while ((dictionary = g_variant_iter_next_value (&iter))) {
MM3gppProfile *profile = NULL;
@@ -167,6 +167,7 @@ build_list_results (GVariant *dictionaries,
saved_error = g_steal_pointer (&inner_error);
} else
profiles = g_list_append (profiles, profile);
+ g_variant_unref (dictionary);
}
}