]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c
fix null DevicePath issue.
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaBusDxe / AtaBus.c
index 875baa88b059ba00536df2e19901fbb1d2d06bf5..6b8257e1b6d42961ec674aa176c26b7cda67882d 100644 (file)
@@ -193,13 +193,16 @@ RegisterAtaDevice (
 \r
   DevicePath = AppendDevicePathNode (AtaBusDriverData->ParentDevicePath, NewDevicePathNode);\r
   if (DevicePath == NULL) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
     goto Done;\r
   }\r
 \r
   DeviceHandle = NULL;\r
+  RemainingDevicePath = DevicePath;\r
   Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);\r
   if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {\r
     Status = EFI_ALREADY_STARTED;\r
+    FreePool (DevicePath);\r
     goto Done;\r
   }\r
 \r