According to UEFI 2.3.1, the gBS->FreePool () function returns the memory 
specified by Buffer to the system, but the address, which was allocated by 
gBS->AllocatePool() function, doesn't go back to NULL.

For safety purpose, I think that set Buffer to NULL is reasonable.

Best regards,
Charlie Hsu

-----Original Message-----
From: Andrew Fish [mailto:[email protected]] 
Sent: Tuesday, October 30, 2012 3:28 PM
To: [email protected]
Subject: Re: [edk2] About function UncachedSafeFreePool ()


On Oct 30, 2012, at 3:05 PM, 幰彰王 wrote:

> Hi all,
> I think the statement "Buffer = NULL;" is redundant or we might modify the 
> function as below:
> 
> STATIC
> VOID
> EFIAPI
> SafeFreePool (
>   IN VOID   **Buffer
>   )
> {
>   if (*Buffer != NULL) {
>     gBS->FreePool (*Buffer);
>     *Buffer = NULL;
>   }
> }
> 
> How do you think about this?
> 

I think changing the library API by adding an extra * to buffer would break all 
the calling code. 

I agree that setting the pointer, that is just in a register, to NULL does 
nothing. We should probably just remove the `Buffer = NULL` from the library 
function. 

> Regards,
> -Hsien
> 
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to