[PATCH] broadband-modem,plugins: fix GMatchInfo leaks

Ben Chan benchan at chromium.org
Mon Aug 11 12:42:38 PDT 2014


---
 plugins/huawei/mm-broadband-modem-huawei.c   | 2 ++
 plugins/mtk/mm-broadband-modem-mtk.c         | 5 +++--
 plugins/novatel/mm-broadband-modem-novatel.c | 1 +
 plugins/x22x/mm-broadband-modem-x22x.c       | 1 +
 src/mm-broadband-modem.c                     | 1 +
 5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
index 400049d..ce1fb6f 100644
--- a/plugins/huawei/mm-broadband-modem-huawei.c
+++ b/plugins/huawei/mm-broadband-modem-huawei.c
@@ -634,6 +634,8 @@ load_unlock_retries_finish (MMIfaceModem *self,
                          MM_CORE_ERROR_FAILED,
                          "Could not parse ^CPIN results: Response didn't match (%s)",
                          result);
+
+        g_match_info_free (match_info);
         g_regex_unref (r);
         return NULL;
     }
diff --git a/plugins/mtk/mm-broadband-modem-mtk.c b/plugins/mtk/mm-broadband-modem-mtk.c
index 63b37ac..df90046 100644
--- a/plugins/mtk/mm-broadband-modem-mtk.c
+++ b/plugins/mtk/mm-broadband-modem-mtk.c
@@ -218,7 +218,7 @@ get_supported_modes_ready (MMBaseModem *self,
             G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
     g_assert (r != NULL);
 
-    if(!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &match_error)) {
+    if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &match_error)) {
         if (match_error) {
             g_propagate_error (&error, match_error);
         } else {
@@ -228,8 +228,9 @@ get_supported_modes_ready (MMBaseModem *self,
                          "Failed to match EGMR response: %s", response);
         }
 
+        g_match_info_free (match_info);
         g_regex_unref (r);
-            return;
+        return;
     }
 
     if (!mm_get_int_from_match_info (match_info, 1, &device_type)) {
diff --git a/plugins/novatel/mm-broadband-modem-novatel.c b/plugins/novatel/mm-broadband-modem-novatel.c
index e4b6b6a..765595e 100644
--- a/plugins/novatel/mm-broadband-modem-novatel.c
+++ b/plugins/novatel/mm-broadband-modem-novatel.c
@@ -195,6 +195,7 @@ nwrat_query_ready (MMBaseModem *self,
                                              response);
         g_simple_async_result_complete (simple);
         g_object_unref (simple);
+        g_match_info_free (match_info);
         g_regex_unref (r);
         return;
     }
diff --git a/plugins/x22x/mm-broadband-modem-x22x.c b/plugins/x22x/mm-broadband-modem-x22x.c
index 0cfccb4..ee611f2 100644
--- a/plugins/x22x/mm-broadband-modem-x22x.c
+++ b/plugins/x22x/mm-broadband-modem-x22x.c
@@ -145,6 +145,7 @@ load_current_modes_finish (MMIfaceModem *self,
                          "Couldn't match +SYSSEL reply: %s", response);
         }
 
+        g_match_info_free (match_info);
         g_regex_unref (r);
         return FALSE;
     }
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 93be6a5..17c128c 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -5981,6 +5981,7 @@ sms_text_part_list_ready (MMBroadbandModem *self,
                                          MM_CORE_ERROR_INVALID_ARGS,
                                          "Couldn't parse SMS list response");
         list_parts_context_complete_and_free (ctx);
+        g_match_info_free (match_info);
         g_regex_unref (r);
         return;
     }
-- 
2.0.0.526.g5318336



More information about the ModemManager-devel mailing list