mirror of https://github.com/acidanthera/audk.git
Add NULL pointer check before free pool.
Signed-off-by: lzeng14 Reviewed-by: rsun3 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12656 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d09ed37fb1
commit
cdd9529279
|
@ -13,7 +13,7 @@
|
|||
* Dp uses this information to group records in different ways. It also uses
|
||||
* timer information to calculate elapsed time for each measurement.
|
||||
*
|
||||
* Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
* Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -85,6 +85,19 @@ PARAM_ITEM_LIST ParamList[] = {
|
|||
|
||||
///@}
|
||||
|
||||
/**
|
||||
Wrap original FreePool to check NULL pointer first.
|
||||
**/
|
||||
VOID
|
||||
SafeFreePool (
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
if (Buffer != NULL) {
|
||||
FreePool (Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Transfer the param list value and get the command line parse.
|
||||
|
||||
|
@ -433,23 +446,23 @@ InitializeDp (
|
|||
ListIndex ++;
|
||||
}
|
||||
FreePool (DpParamList);
|
||||
|
||||
FreePool (StringDpOptionQh);
|
||||
FreePool (StringDpOptionLh);
|
||||
FreePool (StringDpOptionUh);
|
||||
FreePool (StringDpOptionLv);
|
||||
FreePool (StringDpOptionUs);
|
||||
FreePool (StringDpOptionLs);
|
||||
FreePool (StringDpOptionUa);
|
||||
FreePool (StringDpOptionUr);
|
||||
FreePool (StringDpOptionUt);
|
||||
FreePool (StringDpOptionUp);
|
||||
FreePool (StringDpOptionLx);
|
||||
FreePool (StringDpOptionLn);
|
||||
FreePool (StringDpOptionLt);
|
||||
FreePool (StringPtr);
|
||||
FreePool (mPrintTokenBuffer);
|
||||
|
||||
|
||||
SafeFreePool (StringDpOptionQh);
|
||||
SafeFreePool (StringDpOptionLh);
|
||||
SafeFreePool (StringDpOptionUh);
|
||||
SafeFreePool (StringDpOptionLv);
|
||||
SafeFreePool (StringDpOptionUs);
|
||||
SafeFreePool (StringDpOptionLs);
|
||||
SafeFreePool (StringDpOptionUa);
|
||||
SafeFreePool (StringDpOptionUr);
|
||||
SafeFreePool (StringDpOptionUt);
|
||||
SafeFreePool (StringDpOptionUp);
|
||||
SafeFreePool (StringDpOptionLx);
|
||||
SafeFreePool (StringDpOptionLn);
|
||||
SafeFreePool (StringDpOptionLt);
|
||||
SafeFreePool (StringPtr);
|
||||
SafeFreePool (mPrintTokenBuffer);
|
||||
|
||||
HiiRemovePackages (gHiiHandle);
|
||||
return Status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue