Date
1 - 2 of 2
Memory leak in the BootManager code
Konstantin Aladyshev
I'm not just asking about the fact that the dynamically allocated
toggle quoted message
Show quoted text
'HelpString' must be freed, i.e. this: ``` HelpString = AllocateZeroPool (...); HiiSetString(HiiHandle, 0, HelpString, NULL) FreePool(HelpString); ``` I'm asking, do we need to do something to free the newly allocated EFI_HII_STRING_BLOCK's? Because every call to the "HiiSetString(HiiHandle, 0, <Text>, NULL)" eventually calls the "EFI_HII_STRING_PROTOCOL.NewString()" function. This function modifies the current 'EFI_HII_STRING_PACKAGE' adding another 'EFI_HII_STRING_BLOCK' to it: ``` typedef struct { UINT8 BlockType; UINT8 BlockBody[]; } EFI_HII_STRING_BLOCK; ``` Even if we would free the "HelpString" itself, these 'EFI_HII_STRING_BLOCK's would be piling up in the HII Database. This is the memory leak that I'm talking about. And I don't see any way in the UEFI specification to remove some 'EFI_HII_STRING_BLOCK' from the 'EFI_HII_STRING_PACKAGE' package. So the only solution that I see is to keep a list of all the allocated StringId's by the Driver, and try to reuse them when possible. But this seems cumbersome, and I don't see such an implementation anywhere in EDKII. Best regards, Konstantin Aladyshev On Sat, Oct 8, 2022 at 5:32 AM gaoliming <gaoliming@...> wrote:
|
|
Ni, Ray
+ Mike Rothman
toggle quoted message
Show quoted text
-----Original Message----- |
|