From ae21d851e8d02fbe087f7cc0b7205193ba7118ac Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 23 Oct 2019 15:25:10 +0200 Subject: [PATCH] device/wwan: fix leak of "error" variable in connect_ready() Fixes: 105ee6e5a9aa ('device: fix crash by handling connection cancellation') --- src/devices/wwan/nm-modem-broadband.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index 0510902a31..eb5b21aa7e 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -341,15 +341,18 @@ connect_ready (MMModemSimple *simple_iface, GAsyncResult *res, NMModemBroadband *self) { - ConnectContext *ctx = NULL; + ConnectContext *ctx; GError *error = NULL; NMModemIPMethod ip4_method = NM_MODEM_IP_METHOD_UNKNOWN; NMModemIPMethod ip6_method = NM_MODEM_IP_METHOD_UNKNOWN; + MMBearer *bearer; - MMBearer *bearer = mm_modem_simple_connect_finish (simple_iface, res, &error); + bearer = mm_modem_simple_connect_finish (simple_iface, res, &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_error_free (error); return; + } ctx = self->_priv.ctx;