Fix potential memory leak with identity/radius_cui

ieee802_11_set_radius_info() might be called with a STA entry that has
already stored identity and/or radius_cui information, so make sure the
old values get freed before being replaced by the new ones.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
This commit is contained in:
Michael Braun 2017-05-18 15:21:54 +02:00 committed by Jouni Malinen
parent 473e51762d
commit 17a8a9893f

View file

@ -1648,8 +1648,11 @@ ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
sta->psk = NULL; sta->psk = NULL;
} }
os_free(sta->identity);
sta->identity = *identity; sta->identity = *identity;
*identity = NULL; *identity = NULL;
os_free(sta->radius_cui);
sta->radius_cui = *radius_cui; sta->radius_cui = *radius_cui;
*radius_cui = NULL; *radius_cui = NULL;