diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-09-04 17:15:04 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-09-04 17:59:59 +0200 |
commit | be079381c06427f4748be245dc7c89fefed35293 (patch) | |
tree | 7123a6be4e6f1b069740209df0f7c18ada7976ac /plugins | |
parent | 76916de31350b915c7cdd7d89fee08f03a97800f (diff) |
telit: avoid leaking SIM object
We were getting the SIM object for all paths, but only using (and
disposing it) in the AFTER_POWER_UP_STEP_GET_SIM_IDENTIFIER step.
Update the logic to only retrieve, use and dispose the SIM object in
the step that is needed, and therefore avoid leaking it in the
remaining steps.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/telit/mm-broadband-modem-telit.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c index 782b5fbf..d517f549 100644 --- a/plugins/telit/mm-broadband-modem-telit.c +++ b/plugins/telit/mm-broadband-modem-telit.c @@ -985,32 +985,36 @@ after_power_up_step (GTask *task) { AfterPowerUpContext *ctx; MMBroadbandModemTelit *self; - MMBaseSim *sim = NULL; ctx = g_task_get_task_data (task); self = g_task_get_source_object (task); - g_object_get (MM_BROADBAND_MODEM_TELIT (self), - MM_IFACE_MODEM_SIM, &sim, - NULL); - if (!sim) { - g_task_return_new_error (task, - MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "could not acquire sim object"); - return; - } - switch (ctx->step) { case AFTER_POWER_UP_STEP_FIRST: /* Fall back on next step */ ctx->step++; - case AFTER_POWER_UP_STEP_GET_SIM_IDENTIFIER: + + case AFTER_POWER_UP_STEP_GET_SIM_IDENTIFIER: { + MMBaseSim *sim = NULL; + + g_object_get (MM_BROADBAND_MODEM_TELIT (self), + MM_IFACE_MODEM_SIM, &sim, + NULL); + if (!sim) { + g_task_return_new_error (task, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "could not acquire sim object"); + return; + } + mm_base_sim_load_sim_identifier (sim, (GAsyncReadyCallback)load_sim_identifier_ready, task); g_object_unref (sim); return; + } + case AFTER_POWER_UP_STEP_ENABLE_QSS_PARSING: mm_dbg ("Stop ignoring #QSS"); self->priv->parse_qss = TRUE; |