summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c
diff options
context:
space:
mode:
Diffstat (limited to 'CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c')
-rw-r--r--CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c b/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c
index 544f07215b..964545f143 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c
@@ -38,5 +38,11 @@ void *realloc (void *ptr, size_t size)
/* De-allocates or frees a memory block */
void free (void *ptr)
{
- FreePool (ptr);
+ //
+ // In Standard C, free() handles a null pointer argument transparently. This
+ // is not true of FreePool() below, so protect it.
+ //
+ if (ptr != NULL) {
+ FreePool (ptr);
+ }
}