On Sep 17, 2013, at 2:55 AM, Laszlo Ersek <ler...@redhat.com> wrote:

> On 09/17/13 08:36, Ryan Harkin wrote:
> 
>> I think FreePool(NULL) should just return without reporting an error.
> 
> I agree that it could simplify some error/exit paths.
> 
> It may not match the general "UEFI interface style" though. In my
> experience only pointers to optional parameters may be NULL, and
> FreePool() doesn't consider its parameter optional.
> 
> You could always write a trivial wrapper for it...
> 

I've seen SafeFreePool() used for this. 

https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/MemoryAllocationLib.h
/**
  Frees a buffer that was previously allocated with one of the pool allocation 
functions in the
  Memory Allocation Library.

  Frees the buffer specified by Buffer.  Buffer must have been allocated on a 
previous call to the
  pool allocation services of the Memory Allocation Library.  If it is not 
possible to free pool
  resources, then this function will perform no actions.
  
  If Buffer was not allocated with a pool allocation function in the Memory 
Allocation Library,
  then ASSERT().

  @param  Buffer                Pointer to the buffer to free.

**/


> \Laszlo
> 
> 
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to