From: Jouni Malinen Date: Sat, 28 Nov 2015 17:43:55 +0000 (+0200) Subject: EAP-SIM peer: Fix memory leak on reauth error path X-Git-Tag: hostap_2_6~1298 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea52a46e1313d67f85fd21952f353d8dbb2a5ca0;p=thirdparty%2Fhostap.git EAP-SIM peer: Fix memory leak on reauth error path If init_for_reauth fails, the EAP-SIM peer state was not freed properly. Use eap_sim_deinit() to make sure all allocations get freed. This could be hit only if no random data could be derived for NONCE_MT. Signed-off-by: Jouni Malinen --- diff --git a/src/eap_peer/eap_sim.c b/src/eap_peer/eap_sim.c index 99a2816ce..cbf7461a1 100644 --- a/src/eap_peer/eap_sim.c +++ b/src/eap_peer/eap_sim.c @@ -1135,7 +1135,7 @@ static void * eap_sim_init_for_reauth(struct eap_sm *sm, void *priv) if (random_get_bytes(data->nonce_mt, EAP_SIM_NONCE_MT_LEN)) { wpa_printf(MSG_WARNING, "EAP-SIM: Failed to get random data " "for NONCE_MT"); - os_free(data); + eap_sim_deinit(sm, data); return NULL; } data->num_id_req = 0;