EAP server: Simplify EAP method registration call

Free the allocated structure in error cases to remove need for each EAP
method to handle the error cases separately. Each registration function
can simply do "return eap_server_method_register(eap);" in the end of
the function.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2016-01-13 23:35:53 +02:00 committed by Jouni Malinen
parent 49a26bb3e3
commit 814f43cff5
22 changed files with 33 additions and 122 deletions

View file

@ -520,7 +520,6 @@ static u8 * eap_sake_get_session_id(struct eap_sm *sm, void *priv, size_t *len)
int eap_server_sake_register(void)
{
struct eap_method *eap;
int ret;
eap = eap_server_method_alloc(EAP_SERVER_METHOD_INTERFACE_VERSION,
EAP_VENDOR_IETF, EAP_TYPE_SAKE, "SAKE");
@ -538,8 +537,5 @@ int eap_server_sake_register(void)
eap->get_emsk = eap_sake_get_emsk;
eap->getSessionId = eap_sake_get_session_id;
ret = eap_server_method_register(eap);
if (ret)
eap_server_method_free(eap);
return ret;
return eap_server_method_register(eap);
}