Free dh_ctx on failure in wps_nfc_gen_dh()

This is needed to avoid a memory leak on an error path.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Srikanth Marepalli 2018-09-20 14:46:54 +05:30 committed by Jouni Malinen
parent 50b77f50e8
commit e662260162

View file

@ -654,6 +654,7 @@ int wps_nfc_gen_dh(struct wpabuf **pubkey, struct wpabuf **privkey)
pub = wpabuf_zeropad(pub, 192);
if (pub == NULL) {
wpabuf_free(priv);
dh5_free(dh_ctx);
return -1;
}
wpa_hexdump_buf(MSG_DEBUG, "WPS: Generated new DH pubkey", pub);