From: erictian Date: Thu, 10 Mar 2011 05:01:15 +0000 (+0000) Subject: fix null DevicePath issue. X-Git-Tag: edk2-stable201903~15117 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e70ae46c0009d8e51b184aacf09817748082cce6 fix null DevicePath issue. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11360 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c index 875baa88b0..6b8257e1b6 100644 --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c @@ -193,13 +193,16 @@ RegisterAtaDevice ( DevicePath = AppendDevicePathNode (AtaBusDriverData->ParentDevicePath, NewDevicePathNode); if (DevicePath == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } DeviceHandle = NULL; + RemainingDevicePath = DevicePath; Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle); if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) { Status = EFI_ALREADY_STARTED; + FreePool (DevicePath); goto Done; }