From da55fa769ee98aa4ec731418086cbff264eb4401 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 17 Jan 2023 08:34:02 +0100 Subject: [PATCH] base-modem-at: make abort_task_if_port_unusable() unref the GTask Aleksander seems to prefer it this way. Looks better. Suggested-by: Aleksander Morgado --- src/mm-base-modem-at.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mm-base-modem-at.c b/src/mm-base-modem-at.c index b61607da..f7bc6a59 100644 --- a/src/mm-base-modem-at.c +++ b/src/mm-base-modem-at.c @@ -35,6 +35,7 @@ abort_task_if_port_unusable (MMBaseModem *self, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND, "Cannot run sequence: port not given"); + g_object_unref (task); return FALSE; } @@ -44,6 +45,7 @@ abort_task_if_port_unusable (MMBaseModem *self, MM_CORE_ERROR, MM_CORE_ERROR_CONNECTED, "Cannot run sequence: port is connected"); + g_object_unref (task); return FALSE; } @@ -60,6 +62,7 @@ abort_task_if_port_unusable (MMBaseModem *self, "Cannot run sequence: '%s'", error->message); g_error_free (error); + g_object_unref (task); return FALSE; } @@ -235,10 +238,8 @@ at_sequence_common (MMBaseModem *self, AtSequenceContext *ctx; /* Ensure that we have an open port */ - if (!abort_task_if_port_unusable (self, port, task)) { - g_object_unref (task); + if (!abort_task_if_port_unusable (self, port, task)) return; - } /* Setup context */ ctx = g_new0 (AtSequenceContext, 1); @@ -540,10 +541,8 @@ at_command_common (MMBaseModem *self, AtCommandContext *ctx; /* Ensure that we have an open port */ - if (!abort_task_if_port_unusable (self, port, task)) { - g_object_unref (task); + if (!abort_task_if_port_unusable (self, port, task)) return; - } ctx = g_new0 (AtCommandContext, 1); ctx->port = g_object_ref (port);