Fix couple of memory leaks in PKCS7_dataDecode().
authorRichard Levitte <levitte@openssl.org>
Thu, 5 Apr 2001 10:19:12 +0000 (10:19 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 5 Apr 2001 10:19:12 +0000 (10:19 +0000)
(provided by Stephen)

CHANGES
crypto/pkcs7/pk7_doit.c

diff --git a/CHANGES b/CHANGES
index 785d43abdab27f41c831d47140d9634a5fa40b20..32d49f3f5e3779ab8fa2c97ebf6079a9a71ef662 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@
 
  Changes between 0.9.6 and 0.9.7  [xx XXX 2000]
 
 
  Changes between 0.9.6 and 0.9.7  [xx XXX 2000]
 
+  *) Fix a couple of memory leaks in PKCS7_dataDecode()
+     [Steve Henson, reported by Heyun Zheng <hzheng@atdsprint.com>]
+
   *) Change Configure and Makefiles to provide EXE_EXT, which will contain
      the default extension for executables, if any.  Also, make the perl
      scripts that use symlink() to test if it really exists and use "cp"
   *) Change Configure and Makefiles to provide EXE_EXT, which will contain
      the default extension for executables, if any.  Also, make the perl
      scripts that use symlink() to test if it really exists and use "cp"
index d0f3ed0411c94fcc0f1c2fbc35f603f2e0e23fbc..921195f9344e576796b2d6c51a4d6d82647f1d42 100644 (file)
@@ -370,7 +370,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
                if (ri == NULL) {
                        PKCS7err(PKCS7_F_PKCS7_DATADECODE,
                                 PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE);
                if (ri == NULL) {
                        PKCS7err(PKCS7_F_PKCS7_DATADECODE,
                                 PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE);
-                       return(NULL);
+                       goto err;
                }
 
                jj=EVP_PKEY_size(pkey);
                }
 
                jj=EVP_PKEY_size(pkey);
@@ -393,7 +393,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
                BIO_get_cipher_ctx(etmp,&evp_ctx);
                EVP_CipherInit(evp_ctx,evp_cipher,NULL,NULL,0);
                if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0)
                BIO_get_cipher_ctx(etmp,&evp_ctx);
                EVP_CipherInit(evp_ctx,evp_cipher,NULL,NULL,0);
                if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0)
-                       return(NULL);
+                       goto err;
 
                if (jj != EVP_CIPHER_CTX_key_length(evp_ctx)) {
                        /* Some S/MIME clients don't use the same key
 
                if (jj != EVP_CIPHER_CTX_key_length(evp_ctx)) {
                        /* Some S/MIME clients don't use the same key