From 62cc4de68ee27769407350e58ed9a6aeba45f73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 28 Mar 2026 00:15:17 +0100 Subject: [PATCH] broadband-modem-mtk-legacy: fix `GError` memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the error matches, then a `+CIMI` command is sent to the device and processing continues. However, the current error (for the `+CPIN?` command) is not freed or propagated, fix that. Fixes: 5c1fcbfe4a6e ("mtk-legacy: read IMSI if CPIN response is an error") Signed-off-by: Barnabás Pőcze --- src/plugins/mtk/mm-broadband-modem-mtk-legacy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/mtk/mm-broadband-modem-mtk-legacy.c b/src/plugins/mtk/mm-broadband-modem-mtk-legacy.c index fe1f48cb..a4c7418f 100644 --- a/src/plugins/mtk/mm-broadband-modem-mtk-legacy.c +++ b/src/plugins/mtk/mm-broadband-modem-mtk-legacy.c @@ -97,7 +97,7 @@ cpin_query_ready (MMIfaceModem *self, { MMModemLock lock = MM_MODEM_LOCK_UNKNOWN; const gchar *result; - GError *error = NULL; + g_autoptr (GError) error = NULL; result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error); if (error) { @@ -118,7 +118,7 @@ cpin_query_ready (MMIfaceModem *self, } /* Otherwise just return the error */ - g_task_return_error (task, error); + g_task_return_error (task, g_steal_pointer (&error)); } else { if (result) lock = mm_parse_cpin_response (result, TRUE);