diff --git a/DuetPkg/SataControllerDxe/SataController.c b/DuetPkg/SataControllerDxe/SataController.c index d1e85cc6e4..1807c88224 100644 --- a/DuetPkg/SataControllerDxe/SataController.c +++ b/DuetPkg/SataControllerDxe/SataController.c @@ -920,6 +920,7 @@ IdeInitCalculateMode ( *SupportedModes = AllocateZeroPool (sizeof (EFI_ATA_COLLECTIVE_MODE)); if (*SupportedModes == NULL) { + ASSERT (*SupportedModes != NULL); return EFI_OUT_OF_RESOURCES; } @@ -931,6 +932,7 @@ IdeInitCalculateMode ( // Make sure we've got the valid identify data of the device from SubmitData() // if (!IdentifyValid) { + FreePool (*SupportedModes); return EFI_NOT_READY; }