Add NULL check in i2d_PrivateKey()
[openssl.git] / crypto / pkcs7 / pk7_doit.c
index b2df65980b3ff73bb5582fd177728868f2753fb4..72bd54d6272ac8206d96de16b54f708e979e3aee 100644 (file)
@@ -1,4 +1,3 @@
-/* crypto/pkcs7/pk7_doit.c */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -809,6 +808,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
                     goto err;
 
                 if (!EVP_SignFinal(ctx_tmp, abuf, &abuflen, si->pkey)) {
+                    OPENSSL_free(abuf);
                     PKCS7err(PKCS7_F_PKCS7_DATAFINAL, ERR_R_EVP_LIB);
                     goto err;
                 }