aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-10-31 10:24:21 (GMT)
committerJouni Malinen <j@w1.fi>2010-10-31 10:24:21 (GMT)
commit79222cfa614594ac7fc32068c209268550440bfb (patch)
tree3fbe4966d6ebb7fa736d9b4dee6cc83a879b92f6
parentd25f7212da92f337665868cc5a7926666ffe8685 (diff)
downloadhostap-79222cfa614594ac7fc32068c209268550440bfb.zip
hostap-79222cfa614594ac7fc32068c209268550440bfb.tar.gz
hostap-79222cfa614594ac7fc32068c209268550440bfb.tar.bz2
P2P: Reorder code to avoid memory leak on error path
-rw-r--r--wpa_supplicant/p2p_supplicant.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 6f07459..1219f69 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -1309,13 +1309,6 @@ static void wpas_sd_req_upnp(struct wpa_supplicant *wpa_s,
return;
}
- version = query[0];
- str = os_malloc(query_len);
- if (str == NULL)
- return;
- os_memcpy(str, query + 1, query_len - 1);
- str[query_len - 1] = '\0';
-
if (wpabuf_tailroom(resp) < 5)
return;
@@ -1324,6 +1317,13 @@ static void wpas_sd_req_upnp(struct wpa_supplicant *wpa_s,
wpabuf_put_u8(resp, P2P_SERV_UPNP);
wpabuf_put_u8(resp, srv_trans_id);
+ version = query[0];
+ str = os_malloc(query_len);
+ if (str == NULL)
+ return;
+ os_memcpy(str, query + 1, query_len - 1);
+ str[query_len - 1] = '\0';
+
dl_list_for_each(usrv, &wpa_s->global->p2p_srv_upnp,
struct p2p_srv_upnp, list) {
if (version != usrv->version)