From 93f5f800d6d40f21c3936da2bf062b474d7c0aa4 Mon Sep 17 00:00:00 2001 From: olszomal Date: Mon, 27 Feb 2023 08:40:05 +0100 Subject: [PATCH] Fix resource leak, CID 1535262 --- osslsigncode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osslsigncode.c b/osslsigncode.c index c7950a0..40a0335 100644 --- a/osslsigncode.c +++ b/osslsigncode.c @@ -3497,9 +3497,9 @@ static int pe_calc_digest(char *indata, int mdtype, u_char *mdbuf, FILE_HEADER * } if (!header->sigpos) { /* pad (with 0's) unsigned PE file to 8 byte boundary */ - char *buf = OPENSSL_malloc(8); int len = 8 - header->fileend % 8; if (len > 0 && len != 8) { + char *buf = OPENSSL_malloc(8); memset(buf, 0, (size_t)len); BIO_write(bhash, buf, len); OPENSSL_free(buf);