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.
This commit is contained in:
Aleksander Morgado
2022-01-11 11:33:38 +01:00
parent fa1e581f13
commit c3fcb66acf

View File

@@ -1776,7 +1776,6 @@ dms_set_operating_mode_timeout_cb (MMBroadbandModemQmi *self)
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Operation timed out. Did not get any indication"); "Operation timed out. Did not get any indication");
dms_set_operating_mode_complete (self, error); dms_set_operating_mode_complete (self, error);
g_object_unref (self);
} }
static void static void
@@ -1976,7 +1975,7 @@ dms_set_operating_mode (MMBroadbandModemQmi *self)
mm_obj_dbg (self, "Starting timeout for indication receiving for 10 seconds"); mm_obj_dbg (self, "Starting timeout for indication receiving for 10 seconds");
self->priv->set_operating_timeout_id = g_timeout_add_seconds (10, self->priv->set_operating_timeout_id = g_timeout_add_seconds (10,
(GSourceFunc) dms_set_operating_mode_timeout_cb, (GSourceFunc) dms_set_operating_mode_timeout_cb,
g_object_ref (self)); self);
} }
static void static void