diff mbox

Avoid to update probe response IE when IE pointer is NULL

Message ID E62404B31D39064FBDD0B843ADF05A7D2DA859F80E@SC-VEXCH4.marvell.com
State Changes Requested
Headers show

Commit Message

Stone Piao Jan. 24, 2013, 12:30 p.m. UTC
From fff30632be8c6961d8f8bceab7153707a22bbf96 Mon Sep 17 00:00:00 2001
From: Stone Piao <piaoyun@marvell.com>
Date: Thu, 24 Jan 2013 15:20:46 -0500
Subject: [PATCH] Avoid to update probe response IE when IE pointer is NULL

Signed-off-by: Stone Piao <piaoyun@marvell.com>
---
 wpa_supplicant/p2p_supplicant.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Comments

Jouni Malinen Feb. 3, 2013, 11:13 a.m. UTC | #1
On Thu, Jan 24, 2013 at 04:30:03AM -0800, Stone Piao wrote:
> Subject: [PATCH] Avoid to update probe response IE when IE pointer is NULL

> diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
> @@ -4153,8 +4153,10 @@ static void wpas_p2p_ie_update(void *ctx, struct wpabuf *beacon_ies,
> -		wpabuf_free(hapd->p2p_probe_resp_ie);
> -		hapd->p2p_probe_resp_ie = proberesp_ies;
> +		if (proberesp_ies) {
> +			wpabuf_free(hapd->p2p_probe_resp_ie);
> +			hapd->p2p_probe_resp_ie = proberesp_ies;
> +		}

Why would this be needed? The only caller of the ie_update() callback is
p2p_group_update_ies() and it does not use the callback unless
probe_resp_ie is set to non-NULL value.
diff mbox

Patch

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 0a09b00..c1ac6fa 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4153,8 +4153,10 @@  static void wpas_p2p_ie_update(void *ctx, struct wpabuf *beacon_ies,
 			wpabuf_free(hapd->p2p_beacon_ie);
 			hapd->p2p_beacon_ie = beacon_ies;
 		}
-		wpabuf_free(hapd->p2p_probe_resp_ie);
-		hapd->p2p_probe_resp_ie = proberesp_ies;
+		if (proberesp_ies) {
+			wpabuf_free(hapd->p2p_probe_resp_ie);
+			hapd->p2p_probe_resp_ie = proberesp_ies;
+		}
 	} else {
 		wpabuf_free(beacon_ies);
 		wpabuf_free(proberesp_ies);