diff options
-rw-r--r-- | CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c b/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c index 616ee7717e..45ef9ff5f2 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c @@ -434,5 +434,11 @@ void *realloc (void *ptr, size_t size) /* Deallocates or frees a memory block */
void free (void *ptr)
{
- RuntimeFreeMem (ptr);
+ //
+ // In Standard C, free() handles a null pointer argument transparently. This
+ // is not true of RuntimeFreeMem() below, so protect it.
+ //
+ if (ptr != NULL) {
+ RuntimeFreeMem (ptr);
+ }
}
|