X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FDxeHstiLib%2FHstiDxe.c;h=d08d8def0cb5fdf3b91a84720cd189faf6fd556a;hp=c7a5769bf582196a4f05602defac402dd4ef69c9;hb=ebe8ef866b7003ffa222ab8bb20b989f0132f206;hpb=aaedfe3c126c434badb608284ad72d8a07ce162b diff --git a/MdePkg/Library/DxeHstiLib/HstiDxe.c b/MdePkg/Library/DxeHstiLib/HstiDxe.c index c7a5769bf5..d08d8def0c 100644 --- a/MdePkg/Library/DxeHstiLib/HstiDxe.c +++ b/MdePkg/Library/DxeHstiLib/HstiDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -200,18 +200,18 @@ InternalHstiIsValidTable ( // // Check ImplementationID // - for (Index = 0; Index < sizeof(Hsti->ImplementationID); Index++) { + for (Index = 0; Index < sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0]); Index++) { if (Hsti->ImplementationID[Index] == 0) { break; } } - if (Index == sizeof(Hsti->ImplementationID)) { - DEBUG ((EFI_D_ERROR, "ImplementationID is no NUL CHAR\n")); + if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) { + DEBUG ((EFI_D_ERROR, "ImplementationID has no NUL CHAR\n")); return FALSE; } ErrorStringSize = HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3; - ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3); + ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3); // // basic check for ErrorString @@ -297,7 +297,7 @@ HstiLibSetTable ( return EFI_OUT_OF_RESOURCES; } HstiAip->Hsti = AllocateCopyPool (HstiSize, Hsti); - if (HstiAip == NULL) { + if (HstiAip->Hsti == NULL) { FreePool (HstiAip); return EFI_OUT_OF_RESOURCES; } @@ -393,7 +393,7 @@ InternalHstiRecordFeaturesVerified ( UINT8 *SecurityFeaturesVerified; EFI_STATUS Status; - Aip = InternalHstiFindAip (Role, ImplementationID, &Hsti, &HstiSize); + Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize); if (Aip == NULL) { return EFI_NOT_STARTED; } @@ -416,6 +416,7 @@ InternalHstiRecordFeaturesVerified ( Hsti, HstiSize ); + FreePool (Hsti); return Status; } @@ -518,7 +519,7 @@ InternalHstiRecordErrorString ( UINTN Offset; EFI_STATUS Status; - Aip = InternalHstiFindAip (Role, ImplementationID, &Hsti, &HstiSize); + Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize); if (Aip == NULL) { return EFI_NOT_STARTED; } @@ -545,6 +546,8 @@ InternalHstiRecordErrorString ( NewHsti, NewHstiSize ); + FreePool (Hsti); + FreePool (NewHsti); return Status; }