[gnutls-devel] [PATCH] gnutls-cli: Fixed Possible Memory Leak

Saurav Babu saurav.babu at samsung.com
Thu Jun 18 09:20:32 CEST 2015


This patch fixes possible memory leak in psk_callback() function, rawkey
is allocated memory by gnutls_malloc() and is not freed when
gnutls_hex_decode() returns with error

Signed-off-by: Saurav Babu <saurav.babu at samsung.com>
---
 src/cli.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cli.c b/src/cli.c
index d0e75a2..58c2d1d 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1714,6 +1714,7 @@ psk_callback(gnutls_session_t session, char **username,
 	if (ret < 0) {
 		fprintf(stderr, "Error deriving password: %s\n",
 			gnutls_strerror(ret));
+		gnutls_free(rawkey);
 		gnutls_free(*username);
 		return ret;
 	}
-- 
1.9.1




More information about the Gnutls-devel mailing list