diff options
author | Nathan Williams <njw@chromium.org> | 2011-09-27 13:40:39 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2011-09-27 13:40:39 -0500 |
commit | 8710820156f51d1861b329e6fc12e706304ddda9 (patch) | |
tree | 21fd334c5023fc0aa15a4023b5b10177a6e51ba4 /plugins/mm-modem-zte.c | |
parent | 00670456ffb4b08af3620a95c73601bc15d84eb9 (diff) |
core: ensure that GMatchInfo and GRegex objects are freed properly
In particular, g_regex_match() and g_regex_match_full() allocate a
match_info structure on both success and failure, so calling
g_match_info_free() only in the success case is insufficient.
BUG=None
TEST=Inspection
Change-Id: Iea76b5b5dc3ec48120e15601a5e2dd45322133d8
Diffstat (limited to 'plugins/mm-modem-zte.c')
-rw-r--r-- | plugins/mm-modem-zte.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/mm-modem-zte.c b/plugins/mm-modem-zte.c index 6c9f3954..88ef7344 100644 --- a/plugins/mm-modem-zte.c +++ b/plugins/mm-modem-zte.c @@ -105,7 +105,7 @@ get_allowed_mode_done (MMAtSerialPort *port, { MMCallbackInfo *info = (MMCallbackInfo *) user_data; GRegex *r = NULL; - GMatchInfo *match_info; + GMatchInfo *match_info = NULL; /* If the modem has already been removed, return without * scheduling callback */ @@ -138,8 +138,6 @@ get_allowed_mode_done (MMAtSerialPort *port, pref_acq = atoi (str); g_free (str); - g_match_info_free (match_info); - if (cm_mode < 0 || cm_mode > 2 || pref_acq < 0 || pref_acq > 2) { info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, @@ -164,6 +162,8 @@ get_allowed_mode_done (MMAtSerialPort *port, } done: + if (match_info) + g_match_info_free (match_info); if (r) g_regex_unref (r); mm_callback_info_schedule (info); |