]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Sign.c
CryptoPkg/BaseCryptLib: Fix mismatched memory allocation/free
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptPkcs7Sign.c
index d3b1a907aad9c5ae8138f0c242f15e56e633da0b..0f61d4b4ad4b9ce1f6b919e95c26100fae24cf16 100644 (file)
@@ -34,7 +34,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @param[in]  OtherCerts       Pointer to an optional additional set of certificates to\r
                                include in the PKCS#7 signedData (e.g. any intermediate\r
                                CAs in the chain).\r
-  @param[out] SignedData       Pointer to output PKCS#7 signedData.\r
+  @param[out] SignedData       Pointer to output PKCS#7 signedData. It's caller's\r
+                               responsibility to free the buffer with FreePool().\r
   @param[out] SignedDataSize   Size of SignedData in bytes.\r
 \r
   @retval     TRUE             PKCS#7 data signing succeeded.\r
@@ -167,7 +168,7 @@ Pkcs7Sign (
   // is totally 19 bytes.\r
   //\r
   *SignedDataSize = P7DataSize - 19;\r
-  *SignedData     = malloc (*SignedDataSize);\r
+  *SignedData     = AllocatePool (*SignedDataSize);\r
   if (*SignedData == NULL) {\r
     OPENSSL_free (P7Data);\r
     goto _Exit;\r