From e66226016204631da0c5622e96ce1e5c73a28d38 Mon Sep 17 00:00:00 2001 From: Srikanth Marepalli Date: Thu, 20 Sep 2018 14:46:54 +0530 Subject: [PATCH] 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 --- src/wps/wps_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c index 2e3472177..bcae1ba58 100644 --- a/src/wps/wps_common.c +++ b/src/wps/wps_common.c @@ -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);