From 5a9944e754ff23aa106cd541ce2ae91d15d55f45 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 20 Mar 2023 00:35:15 +0000 Subject: [PATCH] wincng: fix memory leak in `_libssh2_dh_secret()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch-by: iruis on github Assisted-by: Marc Hörsken Bug #846, commit e3487092ef9553af67633c6747cb9ab2f86465e0. Fixes #856 Closes #858 --- src/wincng.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wincng.c b/src/wincng.c index e990af16..9a88379a 100644 --- a/src/wincng.c +++ b/src/wincng.c @@ -2651,6 +2651,9 @@ out: if(agreement) { BCryptDestroySecret(agreement); } + + free(blob); + if(status == STATUS_NOT_SUPPORTED && _libssh2_wincng.hasAlgDHwithKDF == -1) { goto fb; /* fallback to RSA-based implementation */