]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Make last_scan_res update easier for static analyzers
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 25 Apr 2014 20:19:47 +0000 (23:19 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 29 Apr 2014 09:52:10 +0000 (12:52 +0300)
The check based on last_scan_res_used is sufficient for making sure that
last_scan_res is allocated. However, it is a bit too complex for static
analyzers to notice, so add an explicit check to avoid bogus reports.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/bss.c

index 482fc64f7ada053fb979c2aca41ec181593f1fd3..f99a8a71d144719d6747c9de6b8d7eff3474a4d3 100644 (file)
@@ -674,7 +674,8 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
                wpa_s->last_scan_res_size = siz;
        }
 
-       wpa_s->last_scan_res[wpa_s->last_scan_res_used++] = bss;
+       if (wpa_s->last_scan_res)
+               wpa_s->last_scan_res[wpa_s->last_scan_res_used++] = bss;
 }