The MenuOption insert to gMenuOption allocate memory everytime,but not free. Now add the code to free it.
Cc: Liming Gao <liming....@intel.com> Cc: Eric Dong <eric.d...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan...@intel.com> --- .../Universal/DisplayEngineDxe/FormDisplay.c | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c index a391442..66f7dff 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -3728,10 +3728,39 @@ UiDisplayMenu ( } } } /** + Free the UI Menu Option structure data. + + @param MenuOptionList Point to the menu option list which need to be free. + +**/ + +VOID +FreeMenuOptionData( + LIST_ENTRY *MenuOptionList + ) +{ + LIST_ENTRY *Link; + UI_MENU_OPTION *Option; + + // + // Free menu option list + // + while (!IsListEmpty (MenuOptionList)) { + Link = GetFirstNode (MenuOptionList); + Option = MENU_OPTION_FROM_LINK (Link); + if (Option->Description != NULL){ + FreePool(Option->Description); + } + RemoveEntryList (&Option->Link); + FreePool (Option); + } +} + +/** Base on the browser status info to show an pop up message. **/ VOID @@ -3999,10 +4028,15 @@ FormDisplay ( mIsFirstForm = FALSE; gOldFormEntry.HiiHandle = FormData->HiiHandle; CopyGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid); gOldFormEntry.FormId = FormData->FormId; + // + //Free the Ui menu option list. + // + FreeMenuOptionData(&gMenuOption); + return Status; } /** Clear Screen to the initial state. -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel