Tim,

Thank you for bringing this deficiency to our attention.
A fix for this has been checked in to the EDK II source tree on 
www.tianocore.org<http://www.tianocore.org>.


Daryl McDaniel

"Software is like entropy.
 It is difficult to grasp, weighs nothing, and obeys the second law of 
thermodynamics;
 i.e. it always increases."
-- Norman R. Augustine

________________________________
From: Tim Lewis [mailto:[email protected]]
Sent: Saturday, September 22, 2012 2:27 PM
To: [email protected]
Subject: [edk2] free() behavior for NULL pointers.

According to the OpenGroup standard 
(here<http://pubs.opengroup.org/onlinepubs/009695399/functions/free.html>), and 
in Linux (here<http://linux.die.net/man/3/malloc>), free should ignore a NULL 
pointer. "If ptr is a null pointer, no action shall occur." Even the header for 
free() in StdLib's implementation has this line.

However, the implementation in Malloc.c has:

void
free(void *Ptr)
{
  (void) gBS->FreePool (Ptr);
}

However, FreePool does not have this behavior guarantee (thus the various 
"safe" FreePool functions in libraries).

if (Ptr != NULL) {
  (void) gBS->FreePool (Ptr);
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to