Fix memory leak issues Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Sunny Wang <[email protected]> --- MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c index 86b4fac..0830166 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c @@ -2,6 +2,7 @@ Library functions which contain all the code to connect console device. Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> 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 @@ -301,6 +302,7 @@ BmUpdateSystemTableConsole ( EFI_DEVICE_PATH_PROTOCOL *FullDevicePath; EFI_DEVICE_PATH_PROTOCOL *VarConsole; EFI_DEVICE_PATH_PROTOCOL *Instance; + EFI_DEVICE_PATH_PROTOCOL *FullInstance; VOID *Interface; EFI_HANDLE NewHandle; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; @@ -354,6 +356,7 @@ BmUpdateSystemTableConsole ( // // Find console device handle by device path instance // + FullInstance = Instance; Status = gBS->LocateDevicePath ( ConsoleGuid, &Instance, @@ -383,15 +386,18 @@ BmUpdateSystemTableConsole ( TextOut->SetMode (TextOut, 0); } } + FreePool (FullDevicePath); + FreePool (FullInstance); return TRUE; } } - + FreePool (FullInstance); } while (Instance != NULL); // // No any available console devcie found. // + FreePool (FullDevicePath); return FALSE; } -- 2.5.0.windows.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

