aboutsummaryrefslogtreecommitdiff
path: root/plugins/telit
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/telit')
-rw-r--r--plugins/telit/mm-broadband-modem-telit.c9
-rw-r--r--plugins/telit/mm-common-telit.c16
-rw-r--r--plugins/telit/mm-modem-helpers-telit.c13
3 files changed, 16 insertions, 22 deletions
diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c
index 49e48247..bbf3f760 100644
--- a/plugins/telit/mm-broadband-modem-telit.c
+++ b/plugins/telit/mm-broadband-modem-telit.c
@@ -501,10 +501,10 @@ telit_qss_enable_ready (MMBaseModem *self,
GAsyncResult *res,
GTask *task)
{
- QssSetupContext *ctx;
- MMPortSerialAt *port;
- GError **error;
- GRegex *pattern;
+ QssSetupContext *ctx;
+ MMPortSerialAt *port;
+ GError **error;
+ g_autoptr(GRegex) pattern = NULL;
ctx = g_task_get_task_data (task);
@@ -530,7 +530,6 @@ telit_qss_enable_ready (MMBaseModem *self,
(MMPortSerialAtUnsolicitedMsgFn)telit_qss_unsolicited_handler,
self,
NULL);
- g_regex_unref (pattern);
next_step:
ctx->step++;
diff --git a/plugins/telit/mm-common-telit.c b/plugins/telit/mm-common-telit.c
index 2e0b3801..911c605b 100644
--- a/plugins/telit/mm-common-telit.c
+++ b/plugins/telit/mm-common-telit.c
@@ -112,12 +112,12 @@ cache_port_mode (MMPortProbe *probe,
MMDevice *device,
const gchar *reply)
{
- GRegex *r = NULL;
- GRegexCompileFlags flags = G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW;
- GMatchInfo *match_info = NULL;
- GError *error = NULL;
- gboolean ret = FALSE;
- guint portcfg_current;
+ g_autoptr(GRegex) r = NULL;
+ g_autoptr(GMatchInfo) match_info = NULL;
+ GRegexCompileFlags flags = G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW;
+ GError *error = NULL;
+ gboolean ret = FALSE;
+ guint portcfg_current;
/* #PORTCFG: <requested>,<active> */
r = g_regex_new ("#PORTCFG:\\s*(\\d+),(\\d+)", flags, 0, NULL);
@@ -173,9 +173,7 @@ cache_port_mode (MMPortProbe *probe,
ret = TRUE;
out:
- g_match_info_free (match_info);
- g_regex_unref (r);
- if (error != NULL) {
+ if (error) {
mm_obj_dbg (probe, "error while matching #PORTCFG: %s", error->message);
g_error_free (error);
}
diff --git a/plugins/telit/mm-modem-helpers-telit.c b/plugins/telit/mm-modem-helpers-telit.c
index c2061fcd..54cd6a0c 100644
--- a/plugins/telit/mm-modem-helpers-telit.c
+++ b/plugins/telit/mm-modem-helpers-telit.c
@@ -701,11 +701,11 @@ common_parse_bnd_response (const gchar *response,
gpointer log_object,
GError **error)
{
- GError *inner_error = NULL;
- GArray *bands = NULL;
- GMatchInfo *match_info = NULL;
- GRegex *r = NULL;
- const gchar *load_bands_regex = NULL;
+ g_autoptr(GMatchInfo) match_info = NULL;
+ g_autoptr(GRegex) r = NULL;
+ GError *inner_error = NULL;
+ GArray *bands = NULL;
+ const gchar *load_bands_regex = NULL;
static const gchar *load_bands_regex_4g_hex[] = {
[LOAD_BANDS_TYPE_SUPPORTED] = "#BND:"MM_SUPPORTED_BANDS_2G MM_SUPPORTED_BANDS_3G MM_SUPPORTED_BANDS_4G_HEX,
@@ -761,9 +761,6 @@ common_parse_bnd_response (const gchar *response,
goto out;
}
out:
- g_match_info_free (match_info);
- g_regex_unref (r);
-
if (inner_error) {
g_propagate_error (error, inner_error);
g_clear_pointer (&bands, g_array_unref);