mirror of https://github.com/acidanthera/audk.git
Add assertion to make sure the pointer is not NULL.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13877 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d5c5ad419e
commit
5077d4e5df
|
@ -470,11 +470,13 @@ HotkeyGetOptionNumbers (
|
||||||
|
|
||||||
NameSize = sizeof (CHAR16);
|
NameSize = sizeof (CHAR16);
|
||||||
Name = AllocateZeroPool (NameSize);
|
Name = AllocateZeroPool (NameSize);
|
||||||
|
ASSERT (Name != NULL);
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
NewNameSize = NameSize;
|
NewNameSize = NameSize;
|
||||||
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
|
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
Name = ReallocatePool (NameSize, NewNameSize, Name);
|
Name = ReallocatePool (NameSize, NewNameSize, Name);
|
||||||
|
ASSERT (Name != NULL);
|
||||||
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
|
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
|
||||||
NameSize = NewNameSize;
|
NameSize = NewNameSize;
|
||||||
}
|
}
|
||||||
|
@ -490,6 +492,7 @@ HotkeyGetOptionNumbers (
|
||||||
(*Count + 1) * sizeof (UINT16),
|
(*Count + 1) * sizeof (UINT16),
|
||||||
OptionNumbers
|
OptionNumbers
|
||||||
);
|
);
|
||||||
|
ASSERT (OptionNumbers != NULL);
|
||||||
for (Index = 0; Index < *Count; Index++) {
|
for (Index = 0; Index < *Count; Index++) {
|
||||||
if (OptionNumber < OptionNumbers[Index]) {
|
if (OptionNumber < OptionNumbers[Index]) {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue