]> git.proxmox.com Git - mirror_edk2.git/commit - CryptoPkg/Include/Library/BaseCryptLib.h
CryptoPkg/BaseCryptLib: Fix mismatched memory allocation/free
authorLong Qin <qin.long@intel.com>
Tue, 31 Oct 2017 07:50:30 +0000 (15:50 +0800)
committerLong Qin <qin.long@intel.com>
Mon, 6 Nov 2017 06:51:39 +0000 (14:51 +0800)
commit6fe575d052e36b243657a5885b5457decac41f03
treef7af9f3771a44070415b486671facb2188c67f07
parentcf8197a39d07179027455421a182598bd6989999
CryptoPkg/BaseCryptLib: Fix mismatched memory allocation/free

The malloc/free (instead of AllocatePool/FreePool) were used directly
in some wrapper implementations, which was designed to leverage the
light-weight memory management routines at Runtime phase.
The malloc/free and AllocatePool/FreePool usages are required to be
matched, after extra memory size info header was introduced in malloc
wrapper.

This patch corrects two memory allocation cases, which requires the
caller to free the buffer with FreePool() outside the function call.

And some comments were also added to clarify the correct memory
release functions if it's the caller's responsibility to free the
memory buffer.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ting Ye <ting.ye@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
CryptoPkg/Include/Library/BaseCryptLib.h
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Sign.c
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7SignNull.c
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c