From e5045345dffebb89156efae7043e836961720c8d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 23 Jan 2014 17:26:12 -0600 Subject: wifi: fix double-free of error when handling D-Bus scan request The error passed into the function by the manager's auth request logic should not be freed. --- src/devices/nm-device-wifi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/devices/nm-device-wifi.c b/src/devices/nm-device-wifi.c index 1b1c3ff9b3..5415527cfe 100644 --- a/src/devices/nm-device-wifi.c +++ b/src/devices/nm-device-wifi.c @@ -1389,21 +1389,25 @@ request_scan_cb (NMDevice *device, gpointer user_data) { NMDeviceWifi *self = NM_DEVICE_WIFI (device); + GError *local = NULL; if (error) { dbus_g_method_return_error (context, error); - g_clear_error (&error); - } else if (!check_scanning_allowed (self)) { - error = g_error_new_literal (NM_WIFI_ERROR, + return; + } + + if (!check_scanning_allowed (self)) { + local = g_error_new_literal (NM_WIFI_ERROR, NM_WIFI_ERROR_SCAN_NOT_ALLOWED, "Scanning not allowed at this time"); - dbus_g_method_return_error (context, error); - g_error_free (error); - } else { - cancel_pending_scan (self); - request_wireless_scan (self); - dbus_g_method_return (context); + dbus_g_method_return_error (context, local); + g_error_free (local); + return; } + + cancel_pending_scan (self); + request_wireless_scan (self); + dbus_g_method_return (context); } static void -- cgit v1.2.3