EAP-EKE server: Fix a memory leak on an error path

The allocated Response/Commit message was not freed if DH initialization
failed.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2022-04-17 23:37:50 +03:00
parent af052e6e11
commit ae1fb64550

View file

@ -276,6 +276,7 @@ static struct wpabuf * eap_eke_build_commit(struct eap_sm *sm,
if (eap_eke_dh_init(data->sess.dhgroup, data->dh_priv, pub) < 0) { if (eap_eke_dh_init(data->sess.dhgroup, data->dh_priv, pub) < 0) {
wpa_printf(MSG_INFO, "EAP-EKE: Failed to initialize DH"); wpa_printf(MSG_INFO, "EAP-EKE: Failed to initialize DH");
wpabuf_free(msg);
eap_eke_fail(data, EAP_EKE_FAIL_PRIVATE_INTERNAL_ERROR); eap_eke_fail(data, EAP_EKE_FAIL_PRIVATE_INTERNAL_ERROR);
return eap_eke_build_failure(data, id); return eap_eke_build_failure(data, id);
} }