summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--StdLib/LibC/StdLib/Malloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/StdLib/LibC/StdLib/Malloc.c b/StdLib/LibC/StdLib/Malloc.c
index 51068d3a06..3f79deb49b 100644
--- a/StdLib/LibC/StdLib/Malloc.c
+++ b/StdLib/LibC/StdLib/Malloc.c
@@ -137,7 +137,9 @@ calloc(size_t Num, size_t Size)
void
free(void *Ptr)
{
- (void) gBS->FreePool (Ptr);
+ if(Ptr != NULL) {
+ (void) gBS->FreePool (Ptr);
+ }
}
/** The realloc function changes the size of the object pointed to by Ptr to