diff options
author | Dan Williams <dcbw@redhat.com> | 2014-01-23 17:26:12 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-01-23 17:26:12 -0600 |
commit | e5045345dffebb89156efae7043e836961720c8d (patch) | |
tree | a2cf72ff613ddba8d428fb30af3f7993d0d4ba93 /src | |
parent | d9653484859c426f707b4759bc9882f7a57c1152 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/nm-device-wifi.c | 22 |
1 files changed, 13 insertions, 9 deletions
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 |