From 8931a36ca47eda78bbaa4f69da218a3f1c50ed32 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 3 Jul 2014 00:53:13 +0300 Subject: [PATCH] P2P: Add explicit check for ssid->p2p_client_list != NULL This would not really be needed since these functions check the pointer above. However, this seems to be too difficult for some static analyzer, so add the extra check to avoid false reports. Signed-off-by: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 1ad1a9578..0af5e3264 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -786,7 +786,7 @@ static void wpas_p2p_add_persistent_group_client(struct wpa_supplicant *wpa_s, os_memcpy(n + s->num_p2p_clients * ETH_ALEN, addr, ETH_ALEN); s->p2p_client_list = n; s->num_p2p_clients++; - } else if (!found) { + } else if (!found && s->p2p_client_list) { /* Not enough room for an additional entry - drop the oldest * entry */ os_memmove(s->p2p_client_list, @@ -3188,7 +3188,7 @@ static void wpas_remove_persistent_peer(struct wpa_supplicant *wpa_s, ETH_ALEN) == 0) break; } - if (i >= ssid->num_p2p_clients) { + if (i >= ssid->num_p2p_clients || !ssid->p2p_client_list) { if (ssid->mode != WPAS_MODE_P2P_GO && os_memcmp(ssid->bssid, peer, ETH_ALEN) == 0) { wpa_printf(MSG_DEBUG, "P2P: Remove persistent group %d "