]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-SIM peer: Fix memory leak on reauth error path
authorJouni Malinen <j@w1.fi>
Sat, 28 Nov 2015 17:43:55 +0000 (19:43 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Nov 2015 18:46:36 +0000 (20:46 +0200)
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 <j@w1.fi>
src/eap_peer/eap_sim.c

index 99a2816ce61edd30c0806feda1a7c05b44554a20..cbf7461a1ae8b8c63f94b49fcabd7dbd7e463e8d 100644 (file)
@@ -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;