From 5a7ffb3f60e72d102501cccb5aeb45d9699be529 Mon Sep 17 00:00:00 2001 From: jsg <> Date: Fri, 18 Apr 2014 03:28:12 +0000 Subject: fix another potential double free ok miod@ lteo@ jca@ --- src/lib/libcrypto/pkcs7/pk7_doit.c | 4 ++-- src/lib/libssl/src/crypto/pkcs7/pk7_doit.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 396a863f3b..fbe58cd45f 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c @@ -928,6 +928,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) goto err; free(abuf); + abuf = NULL; if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) goto err; abuf = malloc(siglen); @@ -950,8 +951,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) return 1; err: - if (abuf) - free(abuf); + free(abuf); EVP_MD_CTX_cleanup(&mctx); return 0; diff --git a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c index 396a863f3b..fbe58cd45f 100644 --- a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c +++ b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c @@ -928,6 +928,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) goto err; free(abuf); + abuf = NULL; if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) goto err; abuf = malloc(siglen); @@ -950,8 +951,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) return 1; err: - if (abuf) - free(abuf); + free(abuf); EVP_MD_CTX_cleanup(&mctx); return 0; -- cgit v1.2.3-55-g6feb