OpenSSL: Make dh5_init() match the generic implementation

Commit 4104267e81 ('Fix memory leak on NFC
DH generation error path') modified the generic (non-OpenSSL)
implementation of dh5_init() to free the previously assigned public key,
if any. However, that commit did not modify the OpenSSL specific version
of this function. Add the same change there to maintain consistent
behavior between these two implementations of the same function.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2016-05-10 20:28:08 +03:00 committed by Jouni Malinen
parent 46bac6520d
commit 6a9681e90c

View file

@ -608,6 +608,7 @@ void * dh5_init(struct wpabuf **priv, struct wpabuf **publ)
size_t publen, privlen;
*priv = NULL;
wpabuf_free(*publ);
*publ = NULL;
dh = DH_new();
@ -653,6 +654,7 @@ err:
BIGNUM *p = NULL, *g, *priv_key = NULL, *pub_key = NULL;
*priv = NULL;
wpabuf_free(*publ);
*publ = NULL;
dh = DH_new();