TDLS: Fix TPK M1 error case (CID 68214)

Commit 342bce63cd introduced a possibility
of a NULL pointer dereference on the error path if a new peer entry
fails to get added (i.e., memory allocation failure). Fix that by
skipping the wpa_tdls_peer_free() call if necessary.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-06-17 01:55:36 +03:00
parent d1bb7aeda4
commit 7efc7f66b1

View file

@ -1920,7 +1920,8 @@ skip_rsn_check:
error: error:
wpa_tdls_send_error(sm, src_addr, WLAN_TDLS_SETUP_RESPONSE, dtoken, wpa_tdls_send_error(sm, src_addr, WLAN_TDLS_SETUP_RESPONSE, dtoken,
status); status);
wpa_tdls_peer_free(sm, peer); if (peer)
wpa_tdls_peer_free(sm, peer);
return -1; return -1;
} }