From bc118aa1602b309101f1151805a2d8cdf0f916eb Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 29 Feb 2012 16:51:50 +0100 Subject: [PATCH] modem-helpers: plug memleak g_match_info_fetch() returns always a heap-allocated string which should be freed by the caller. --- src/mm-modem-helpers.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 1feebc9e..9a722368 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -910,9 +910,10 @@ mm_gsm_parse_clck_test_response (const char *reply, if (g_regex_match_full (r, p, strlen (p), 0, 0, &match_info, NULL)) { while (g_match_info_matches (match_info)) { str = g_match_info_fetch (match_info, 1); - if (str) + if (str) { facilities |= mm_gsm_string_to_facility (str); - g_free (str); + g_free (str); + } g_match_info_next (match_info, NULL); success = TRUE; @@ -956,6 +957,8 @@ mm_gsm_parse_clck_response (const char *reply, gboolean *enabled) *enabled = TRUE; else success = FALSE; + + g_free (str); } } g_match_info_free (match_info); @@ -1271,4 +1274,3 @@ done: return array; } -