From c3fcb66acf01266e7e911622529491c25e69c958 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 11 Jan 2022 11:33:38 +0100 Subject: [PATCH] broadband-modem-qmi: don't pass full reference in timeouts The timeout may not be called if we remove it earlier (e.g. if the indication is received) and therefore we must not pass a full new reference, otherwise it may get leaked. There is no problem with the validity of the self pointer in timeout callbacks because we're removing the timeout as part of the operation teardown logic. --- src/mm-broadband-modem-qmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 1ff726c3..64871e74 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -1776,7 +1776,6 @@ dms_set_operating_mode_timeout_cb (MMBroadbandModemQmi *self) MM_CORE_ERROR_FAILED, "Operation timed out. Did not get any indication"); dms_set_operating_mode_complete (self, error); - g_object_unref (self); } static void @@ -1976,7 +1975,7 @@ dms_set_operating_mode (MMBroadbandModemQmi *self) mm_obj_dbg (self, "Starting timeout for indication receiving for 10 seconds"); self->priv->set_operating_timeout_id = g_timeout_add_seconds (10, (GSourceFunc) dms_set_operating_mode_timeout_cb, - g_object_ref (self)); + self); } static void