]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/SataControllerDxe/SataController.c
DuetPkg/SataController: Fix possible memory leak at error handling of SataController...
[mirror_edk2.git] / DuetPkg / SataControllerDxe / SataController.c
index d1e85cc6e4a4b3216976a353b3cf4fc2902fd01c..1807c88224ed355216f65874b0a018c06c1252e8 100644 (file)
@@ -920,6 +920,7 @@ IdeInitCalculateMode (
 \r
   *SupportedModes = AllocateZeroPool (sizeof (EFI_ATA_COLLECTIVE_MODE));\r
   if (*SupportedModes == NULL) {\r
+    ASSERT (*SupportedModes != NULL);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -931,6 +932,7 @@ IdeInitCalculateMode (
   // Make sure we've got the valid identify data of the device from SubmitData()\r
   //\r
   if (!IdentifyValid) {\r
+    FreePool (*SupportedModes);\r
     return EFI_NOT_READY;\r
   }\r
 \r