Commit 37827fca authored by Thomas Haller's avatar Thomas Haller
Browse files

wwan: return from send_pin_ready() when operation cancelled and fix leak

We call the asynchrnous function mm_sim_send_pin() without taking a
reference on @self. During send_pin_ready() we must first check whether
the request was cancelled because self might be a dangling pointer at
this point.

Also, avoid leaking @Error if the ctx is no longer valid.

Fixes: aa0b3796
parent 0b66eb29
......@@ -381,10 +381,13 @@ connect_ready (MMModemSimple *simple_iface,
static void
send_pin_ready (MMSim *sim, GAsyncResult *result, NMModemBroadband *self)
GError *error = NULL;
gs_free_error GError *error = NULL;
mm_sim_send_pin_finish (sim, result, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
if (!self->priv->ctx || self->priv->ctx->step != CONNECT_STEP_UNLOCK)
......@@ -396,7 +399,6 @@ send_pin_ready (MMSim *sim, GAsyncResult *result, NMModemBroadband *self)
} else {
g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, translate_mm_error (error));
g_error_free (error);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment