diff options
author | Dandan Bi <dandan.bi@intel.com> | 2016-01-06 00:57:23 +0000 |
---|---|---|
committer | dandanbi <dandanbi@Edk2> | 2016-01-06 00:57:23 +0000 |
commit | b954a4fe01f3477d28eaf575dd36a9015e315aca (patch) | |
tree | bf19739d478c3063b7440cde6e3a4b6ffc7d7717 /MdeModulePkg/Universal | |
parent | 8339166dd1d8a9b106ee2ee259e5d953d07c5b7c (diff) | |
download | edk2-platforms-b954a4fe01f3477d28eaf575dd36a9015e315aca.tar.xz |
MdeModulePkg:Fix the potential memory leak issue in Display Engine
The MenuOption insert to gMenuOption allocate memory everytime,but not free.
Now add the code to free it.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19593 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c index a391442d16..66f7dffc53 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -3730,6 +3730,35 @@ 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.
@@ -4001,6 +4030,11 @@ FormDisplay ( CopyGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid);
gOldFormEntry.FormId = FormData->FormId;
+ //
+ //Free the Ui menu option list.
+ //
+ FreeMenuOptionData(&gMenuOption);
+
return Status;
}
|