mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 19:10:09 +01:00
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:aa0b379699(cherry picked from commit37827fcafa)
This commit is contained in:
parent
21ca2cf0f6
commit
0b63dbdef7
1 changed files with 4 additions and 2 deletions
|
|
@ -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))
|
||||
return;
|
||||
|
||||
if (!self->priv->ctx || self->priv->ctx->step != CONNECT_STEP_UNLOCK)
|
||||
return;
|
||||
|
||||
|
|
@ -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);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue