wwan: fix leaking "bearer" in connect_ready()

Fixes: 105ee6e5a9 ('device: fix crash by handling connection cancellation')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/669
(cherry picked from commit 5747bdb8b8)
(cherry picked from commit 65e88671d6)
(cherry picked from commit d26f17f24c)
This commit is contained in:
Thomas Haller 2021-02-23 07:15:40 +01:00
parent 8df18958ed
commit 6199287b47
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -358,7 +358,7 @@ connect_ready (MMModemSimple *simple_iface,
GError *error = NULL;
NMModemIPMethod ip4_method = NM_MODEM_IP_METHOD_UNKNOWN;
NMModemIPMethod ip6_method = NM_MODEM_IP_METHOD_UNKNOWN;
MMBearer *bearer;
gs_unref_object MMBearer *bearer = NULL;
bearer = mm_modem_simple_connect_finish (simple_iface, res, &error);
@ -372,7 +372,7 @@ connect_ready (MMModemSimple *simple_iface,
if (!ctx)
return;
self->_priv.bearer = bearer;
self->_priv.bearer = g_steal_pointer (&bearer);
if (!self->_priv.bearer) {
if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_PIN) ||