From deaacda3b2740477733564066eb69d5c94b41bba Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Tue, 2 Aug 2016 13:37:55 +0800 Subject: 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 Reviewed-by: Feng Tian --- MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c index 9eea50dd33..18a07d86b7 100644 --- a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c +++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c @@ -345,6 +345,9 @@ FvNotificationEvent ( Index = 0; BufferSize = sizeof (EFI_HANDLE); Handle = AllocateZeroPool (BufferSize); + if (Handle == NULL) { + return; + } Status = gBS->LocateHandle ( ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, @@ -355,6 +358,9 @@ FvNotificationEvent ( if (EFI_BUFFER_TOO_SMALL == Status) { FreePool (Handle); Handle = AllocateZeroPool (BufferSize); + if (Handle == NULL) { + return; + } Status = gBS->LocateHandle ( ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, -- cgit v1.2.3