From ece88f7697af9918522799697d4ac991b235d2f8 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 25 Apr 2014 23:19:47 +0300 Subject: [PATCH] Make last_scan_res update easier for static analyzers 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 --- wpa_supplicant/bss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 482fc64f7..f99a8a71d 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -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; }