mesh: Fix segfault on error path

When wpa_init() in __mesh_rsn_auth_init() failed, empty rsn->auth caused
segmentation fault due to NULL pointer dereference when wpa_deinit() was
called. Fix this by checking the pointer before executing deinit steps.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
Masashi Honma 2015-08-26 17:32:38 +09:00 committed by Jouni Malinen
parent f029c44cf2
commit a5d2bf2473

View File

@ -190,7 +190,8 @@ static int __mesh_rsn_auth_init(struct mesh_rsn *rsn, const u8 *addr)
static void mesh_rsn_deinit(struct mesh_rsn *rsn)
{
os_memset(rsn->mgtk, 0, sizeof(rsn->mgtk));
wpa_deinit(rsn->auth);
if (rsn->auth)
wpa_deinit(rsn->auth);
}