From 3d108f0bca82120aba53e705752405ce91136aff Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 17 Nov 2014 00:09:50 +0100 Subject: [PATCH] Fixed memory leaks. --- winpr/tools/makecert/makecert.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/winpr/tools/makecert/makecert.c b/winpr/tools/makecert/makecert.c index 5fea4c9bb..8a876b25d 100644 --- a/winpr/tools/makecert/makecert.c +++ b/winpr/tools/makecert/makecert.c @@ -683,7 +683,12 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa bio = BIO_new(BIO_s_mem()); if (!bio) + { + free (filename); + free(fullpath); + fclose(fp); return -1; + } status = PEM_write_bio_PrivateKey(bio, context->pkey, NULL, NULL, 0, NULL, NULL); @@ -694,7 +699,12 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa status = BIO_read(bio, x509_str, length); if (status < 0) + { + free (filename); + free(fullpath); + fclose(fp); return -1; + } offset += status; @@ -712,7 +722,12 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa } if (status < 0) + { + free (filename); + free(fullpath); + fclose(fp); return -1; + } length = offset;