[edk2] [PATCH v2] MdeModulePkg/DisplayEngine: Fix memory leak issues in DisplayEngine

2016-05-19 Thread Dandan Bi
The following codes are useless and cause memory leak issues.
So now remove them.

Cc: Cecil Sheng 
Cc: Qiu Shumin 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c   |  5 +
 MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c | 12 +---
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
index 732dd2f..8e7b735 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
@@ -1,9 +1,9 @@
 /** @file
 Implementation for handling user input from the User Interfaces.
 
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -1297,13 +1297,10 @@ GetSelectionInputPopUp (
   ValueType = 0;
   CurrentOption = NULL;
   ShowDownArrow = FALSE;
   ShowUpArrow   = FALSE;
 
-  StringPtr = AllocateZeroPool ((gOptionBlockWidth + 1) * 2);
-  ASSERT (StringPtr);
-
   ZeroMem (&HiiValue, sizeof (EFI_HII_VALUE));
 
   Question = MenuOption->ThisTag;
   if (Question->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) {
 Link = GetFirstNode (&Question->OptionListHead);
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
index bb2faf3..c61a395 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
@@ -1,10 +1,10 @@
 /** @file
 Implementation for handling the User Interface option processing.
 
 
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -883,22 +883,12 @@ PasswordProcess (
   if (StrCmp (StringPtr, TempString) == 0) { 
 gUserInput->InputValue.Buffer = AllocateCopyPool 
(Question->CurrentValue.BufferLen, StringPtr);
 gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
 gUserInput->InputValue.Type = Question->CurrentValue.Type;
 gUserInput->InputValue.Value.string = HiiSetString(gFormData->HiiHandle, 
gUserInput->InputValue.Value.string, StringPtr, NULL);
-FreePool (StringPtr); 
 
 Status = EFI_SUCCESS;
-
-if (EFI_ERROR (Status)) {
-  //
-  // Reset state machine for password
-  //
-  Question->PasswordCheck (gFormData, Question, NULL);
-}
-
-return Status;
   } else {
 //
 // Reset state machine for password
 //
 Question->PasswordCheck (gFormData, Question, NULL);
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] MdeModulePkg/DisplayEngine: Fix memory leak issues in DisplayEngine

2016-05-25 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Bi, Dandan
> Sent: Friday, May 20, 2016 10:12 AM
> To: edk2-devel@lists.01.org
> Cc: Cecil Sheng; Qiu, Shumin; Dong, Eric
> Subject: [PATCH v2] MdeModulePkg/DisplayEngine: Fix memory leak issues in 
> DisplayEngine
> 
> The following codes are useless and cause memory leak issues.
> So now remove them.
> 
> Cc: Cecil Sheng 
> Cc: Qiu Shumin 
> Cc: Eric Dong 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Dandan Bi 
> ---
>  MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c   |  5 +
>  MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c | 12 +---
>  2 files changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c 
> b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
> index 732dd2f..8e7b735 100644
> --- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
> +++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
> @@ -1,9 +1,9 @@
>  /** @file
>  Implementation for handling user input from the User Interfaces.
> 
> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, 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
>  http://opensource.org/licenses/bsd-license.php
> 
> @@ -1297,13 +1297,10 @@ GetSelectionInputPopUp (
>ValueType = 0;
>CurrentOption = NULL;
>ShowDownArrow = FALSE;
>ShowUpArrow   = FALSE;
> 
> -  StringPtr = AllocateZeroPool ((gOptionBlockWidth + 1) * 2);
> -  ASSERT (StringPtr);
> -
>ZeroMem (&HiiValue, sizeof (EFI_HII_VALUE));
> 
>Question = MenuOption->ThisTag;
>if (Question->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) {
>  Link = GetFirstNode (&Question->OptionListHead);
> diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
> b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
> index bb2faf3..c61a395 100644
> --- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
> +++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
> @@ -1,10 +1,10 @@
>  /** @file
>  Implementation for handling the User Interface option processing.
> 
> 
> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, 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
>  http://opensource.org/licenses/bsd-license.php
> 
> @@ -883,22 +883,12 @@ PasswordProcess (
>if (StrCmp (StringPtr, TempString) == 0) {
>  gUserInput->InputValue.Buffer = AllocateCopyPool 
> (Question->CurrentValue.BufferLen, StringPtr);
>  gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
>  gUserInput->InputValue.Type = Question->CurrentValue.Type;
>  gUserInput->InputValue.Value.string = HiiSetString(gFormData->HiiHandle, 
> gUserInput->InputValue.Value.string, StringPtr, NULL);
> -FreePool (StringPtr);
> 
>  Status = EFI_SUCCESS;
> -
> -if (EFI_ERROR (Status)) {
> -  //
> -  // Reset state machine for password
> -  //
> -  Question->PasswordCheck (gFormData, Question, NULL);
> -}
> -
> -return Status;
>} else {
>  //
>  // Reset state machine for password
>  //
>  Question->PasswordCheck (gFormData, Question, NULL);
> --
> 1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel