Fan, Thanks for your fix, I will help to check in the code later.
Reviewed-by: Eric Dong <[email protected]> Thanks, Eric -----Original Message----- From: Chen Fan [mailto:[email protected]] Sent: Thursday, July 24, 2014 11:54 AM To: [email protected] Subject: [edk2] [PATCH] IntelFrameworkModulePkg BdsLib: Fix potential memory leak when calling BdsLibGetVariableAndSize Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan <[email protected]> --- IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c | 2 ++ IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index c58c6fd..18a370e 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -3568,6 +3568,8 @@ BdsLibBootNext ( ASSERT (BootOption != NULL); BdsLibConnectDevicePath (BootOption->DevicePath); BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData); + FreePool(BootOption); + FreePool(BootNext); } } diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c index 7b3f205..dbb1322 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c @@ -168,6 +168,7 @@ BdsLibGetFreeOptionNumber ( if (OptionBuffer == NULL) { break; } + FreePool(OptionBuffer); Index++; } while (TRUE); @@ -265,6 +266,7 @@ BdsLibRegisterNewOption ( // Validate the variable. // if (!ValidateOption(OptionPtr, OptionSize)) { + FreePool(OptionPtr); continue; } @@ -626,6 +628,7 @@ BdsLibVariableToOption ( // Validate Boot#### variable data. // if (!ValidateOption(Variable, VariableSize)) { + FreePool (Variable); return NULL; } @@ -674,6 +677,7 @@ BdsLibVariableToOption ( // Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION)); if (Option == NULL) { + FreePool (Variable); return NULL; } -- 1.9.3 ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
