]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Free dh_ctx on failure in wps_nfc_gen_dh()
authorSrikanth Marepalli <srimarep@codeaurora.org>
Thu, 20 Sep 2018 09:16:54 +0000 (14:46 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 20 Sep 2018 14:18:16 +0000 (17:18 +0300)
This is needed to avoid a memory leak on an error path.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/wps/wps_common.c

index 2e3472177de9e75c95da539edd70ab506a870b3a..bcae1ba5887b67faf437b249ffb5302d57ad64fc 100644 (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);