mirror of https://github.com/acidanthera/audk.git
MdePkg/UefiFileHandleLib: Fix potential NULL dereference
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2293 Move the NULL check in FileHandleGetInfo() to directly after the allocation to prevent potential NULL dereferences. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
787c4baace
commit
1009b59b65
|
@ -68,6 +68,7 @@ FileHandleGetInfo (
|
|||
// error is expected. getting size to allocate
|
||||
//
|
||||
FileInfo = AllocateZeroPool(FileInfoSize);
|
||||
if (FileInfo != NULL) {
|
||||
//
|
||||
// now get the information
|
||||
//
|
||||
|
@ -78,11 +79,12 @@ FileHandleGetInfo (
|
|||
//
|
||||
// if we got an error free the memory and return NULL
|
||||
//
|
||||
if (EFI_ERROR(Status) && (FileInfo != NULL)) {
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool(FileInfo);
|
||||
FileInfo = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (FileInfo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue