Indicate scan failure event on parameter cloning failure
authorJouni Malinen <j@w1.fi>
Sat, 28 May 2016 19:35:30 +0000 (22:35 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 28 May 2016 19:36:52 +0000 (22:36 +0300)
This is more consistent with the radio_add_work() error case.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/scan.c

index 330679c..cb223ab 100644 (file)
@@ -227,10 +227,8 @@ int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
        }
 
        ctx = wpa_scan_clone_params(params);
-       if (ctx == NULL)
-               return -1;
-
-       if (radio_add_work(wpa_s, 0, "scan", 0, wpas_trigger_scan_cb, ctx) < 0)
+       if (!ctx ||
+           radio_add_work(wpa_s, 0, "scan", 0, wpas_trigger_scan_cb, ctx) < 0)
        {
                wpa_scan_free_params(ctx);
                wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_FAILED "ret=-1");