MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access
Check NULL pointer before access it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
@@ -345,6 +345,9 @@ FvNotificationEvent (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
BufferSize = sizeof (EFI_HANDLE);
|
BufferSize = sizeof (EFI_HANDLE);
|
||||||
Handle = AllocateZeroPool (BufferSize);
|
Handle = AllocateZeroPool (BufferSize);
|
||||||
|
if (Handle == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Status = gBS->LocateHandle (
|
Status = gBS->LocateHandle (
|
||||||
ByProtocol,
|
ByProtocol,
|
||||||
&gEfiFirmwareVolume2ProtocolGuid,
|
&gEfiFirmwareVolume2ProtocolGuid,
|
||||||
@@ -355,6 +358,9 @@ FvNotificationEvent (
|
|||||||
if (EFI_BUFFER_TOO_SMALL == Status) {
|
if (EFI_BUFFER_TOO_SMALL == Status) {
|
||||||
FreePool (Handle);
|
FreePool (Handle);
|
||||||
Handle = AllocateZeroPool (BufferSize);
|
Handle = AllocateZeroPool (BufferSize);
|
||||||
|
if (Handle == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Status = gBS->LocateHandle (
|
Status = gBS->LocateHandle (
|
||||||
ByProtocol,
|
ByProtocol,
|
||||||
&gEfiFirmwareVolume2ProtocolGuid,
|
&gEfiFirmwareVolume2ProtocolGuid,
|
||||||
|
Reference in New Issue
Block a user