Revision: 18722 http://sourceforge.net/p/edk2/code/18722 Author: niruiyu Date: 2015-11-03 02:58:30 +0000 (Tue, 03 Nov 2015) Log Message: ----------- MdeModulePkg: Fix memory leak issues
Fix memory leak issues Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Sunny Wang <sunnyw...@hpe.com> Reviewed-by: Ruiyu Ni <ruiyu...@intel.com> Modified Paths: -------------- trunk/edk2/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c Modified: trunk/edk2/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c =================================================================== --- trunk/edk2/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c 2015-11-03 02:44:48 UTC (rev 18721) +++ trunk/edk2/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c 2015-11-03 02:58:30 UTC (rev 18722) @@ -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 @@ 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,11 +356,13 @@ // // Find console device handle by device path instance // + FullInstance = Instance; Status = gBS->LocateDevicePath ( ConsoleGuid, &Instance, &NewHandle ); + FreePool (FullInstance); if (!EFI_ERROR (Status)) { // // Get the console protocol on this console device handle @@ -383,6 +387,7 @@ TextOut->SetMode (TextOut, 0); } } + FreePool (FullDevicePath); return TRUE; } } @@ -392,6 +397,7 @@ // // No any available console devcie found. // + FreePool (FullDevicePath); return FALSE; } ------------------------------------------------------------------------------ _______________________________________________ edk2-commits mailing list edk2-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-commits