From d26f17f24cbffd1f2149c50683725f14d68dc672 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 23 Feb 2021 07:15:40 +0100 Subject: [PATCH] wwan: fix leaking "bearer" in connect_ready() Fixes: 105ee6e5a9aa ('device: fix crash by handling connection cancellation') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/669 (cherry picked from commit 5747bdb8b851a5c27868d4175b865a915d12549a) (cherry picked from commit 65e88671d6c774775d51ebeae6f54c228281ab47) --- src/devices/wwan/nm-modem-broadband.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index 7b3a13a372..cbdbd4532b 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -369,10 +369,10 @@ static void connect_ready(MMModemSimple *simple_iface, GAsyncResult *res, NMModemBroadband *self) { ConnectContext *ctx; - GError * error = NULL; - NMModemIPMethod ip4_method = NM_MODEM_IP_METHOD_UNKNOWN; - NMModemIPMethod ip6_method = NM_MODEM_IP_METHOD_UNKNOWN; - MMBearer * bearer; + GError * error = NULL; + NMModemIPMethod ip4_method = NM_MODEM_IP_METHOD_UNKNOWN; + NMModemIPMethod ip6_method = NM_MODEM_IP_METHOD_UNKNOWN; + gs_unref_object MMBearer *bearer = NULL; bearer = mm_modem_simple_connect_finish(simple_iface, res, &error); @@ -386,7 +386,7 @@ connect_ready(MMModemSimple *simple_iface, GAsyncResult *res, NMModemBroadband * 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)