Skip to content

Commit 192e7a7

Browse files
olszomalmtrojnar
authored andcommitted
Fixed memory leaks
1 parent 6560516 commit 192e7a7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

msi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,11 @@ static int msi_calc_MsiDigitalSignatureEx(FILE_FORMAT_CTX *ctx, BIO *hash)
22112211
printf("Unable to calculate MSI pre-hash ('metadata') hash\n");
22122212
return 0; /* FAILED */
22132213
}
2214+
if (ctx->msi_ctx->p_msiex) {
2215+
/* attach-signature counts MsiDigitalSignatureEx stream data twice */
2216+
OPENSSL_free(ctx->msi_ctx->p_msiex);
2217+
ctx->msi_ctx->p_msiex = NULL;
2218+
}
22142219
ctx->msi_ctx->p_msiex = OPENSSL_malloc(EVP_MAX_MD_SIZE);
22152220
ctx->msi_ctx->len_msiex = (uint32_t)BIO_gets(prehash,
22162221
(char *)ctx->msi_ctx->p_msiex, EVP_MAX_MD_SIZE);

osslsigncode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4602,7 +4602,7 @@ int main(int argc, char **argv)
46024602
remove_file(options.outfile);
46034603
}
46044604
if (hash)
4605-
BIO_free(hash);
4605+
BIO_free_all(hash);
46064606
BIO_free(outdata);
46074607
}
46084608
if (ctx && ctx->format->ctx_cleanup) {

0 commit comments

Comments
 (0)