EAP-pwd: Fix couple of memory leaks

This commit is contained in:
Jouni Malinen 2010-09-14 22:16:17 -10:00
parent d52be1db76
commit 3d32c6517d
3 changed files with 19 additions and 4 deletions

View file

@ -245,10 +245,11 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
grp->group_num = num; grp->group_num = num;
if (0) { if (0) {
fail: fail:
EC_GROUP_free(grp->group);
EC_POINT_free(grp->pwe); EC_POINT_free(grp->pwe);
BN_free(grp->order); BN_free(grp->order);
BN_free(grp->prime); BN_free(grp->prime);
free(grp); os_free(grp);
grp = NULL; grp = NULL;
ret = 1; ret = 1;
} }

View file

@ -142,8 +142,15 @@ static void eap_pwd_deinit(struct eap_sm *sm, void *priv)
EC_POINT_free(data->my_element); EC_POINT_free(data->my_element);
EC_POINT_free(data->server_element); EC_POINT_free(data->server_element);
os_free(data->id_peer); os_free(data->id_peer);
os_free(data->id_server);
os_free(data->password); os_free(data->password);
if (data->grp) {
EC_GROUP_free(data->grp->group);
EC_POINT_free(data->grp->pwe);
BN_free(data->grp->order);
BN_free(data->grp->prime);
os_free(data->grp); os_free(data->grp);
}
os_free(data); os_free(data);
} }

View file

@ -100,7 +100,7 @@ static void * eap_pwd_init(struct eap_sm *sm)
data->password = os_malloc(sm->user->password_len); data->password = os_malloc(sm->user->password_len);
if (data->password == NULL) { if (data->password == NULL) {
wpa_printf(MSG_INFO, "EAP-PWD: Mmemory allocation password " wpa_printf(MSG_INFO, "EAP-PWD: Memory allocation password "
"fail"); "fail");
os_free(data->id_server); os_free(data->id_server);
os_free(data); os_free(data);
@ -135,7 +135,14 @@ static void eap_pwd_reset(struct eap_sm *sm, void *priv)
EC_POINT_free(data->peer_element); EC_POINT_free(data->peer_element);
os_free(data->id_peer); os_free(data->id_peer);
os_free(data->id_server); os_free(data->id_server);
os_free(data->password);
if (data->grp) {
EC_GROUP_free(data->grp->group);
EC_POINT_free(data->grp->pwe);
BN_free(data->grp->order);
BN_free(data->grp->prime);
os_free(data->grp); os_free(data->grp);
}
os_free(data); os_free(data);
} }