From ce22514e4800dca7854a4778a66e8f08d2b18345 Mon Sep 17 00:00:00 2001 From: Zhang Lubo Date: Thu, 28 Jan 2016 02:32:43 +0000 Subject: NetworkPkg:Fix Network memory leak when calling GetModeData interface Multiple network protocols have a GetModeData() interface, which may allocate memory resource in the return mode data structure. It's callers responsibility to free these buffers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo Reviewed-by: Fu Siyuan Reviewed-by: Wu Jiaxin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19758 6f19259b-4bc3-4df7-8a09-765794883524 --- NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'NetworkPkg/HttpBootDxe') diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c index e5cf894714..2538bd116c 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c @@ -1,7 +1,7 @@ /** @file Functions implementation related with DHCPv6 for HTTP boot driver. -Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 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 that accompanies this distribution. The full text of the license may be found at @@ -974,8 +974,13 @@ ON_EXIT: Dhcp6->Configure (Dhcp6, NULL); } else { ZeroMem (&Config, sizeof (EFI_DHCP6_CONFIG_DATA)); - ZeroMem (&Mode, sizeof (EFI_DHCP6_MODE_DATA)); Dhcp6->Configure (Dhcp6, &Config); + if (Mode.ClientId != NULL) { + FreePool (Mode.ClientId); + } + if (Mode.Ia != NULL) { + FreePool (Mode.Ia); + } } return Status; -- cgit v1.2.3