EAP-pwd: Fix couple of memory leaks
This commit is contained in:
parent
d52be1db76
commit
3d32c6517d
3 changed files with 19 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
os_free(data->grp);
|
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);
|
os_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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->grp);
|
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);
|
os_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue