[edk2] [Patch 2/4] NetworkPkg: Fix a memory leak issue in UDP6 driver

fanwang2 posted 4 patches 6 years, 11 months ago
[edk2] [Patch 2/4] NetworkPkg: Fix a memory leak issue in UDP6 driver
Posted by fanwang2 6 years, 11 months ago
From: Wang Fan <fan.wang@intel.com>

In UDP6Dxe Udp6Groups(), the code return directly without free the
buffer allocated for McastIp when JoinFlag is TRUE. It is a memory
leak issue that needs to be fixed. This patch is to fix this issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/Udp6Dxe/Udp6Main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c
index 9105ef4..8495bc3 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Main.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Main.c
@@ -349,10 +349,13 @@ Udp6Groups (
     }
   }
 
   Instance = UDP6_INSTANCE_DATA_FROM_THIS (This);
   if (!Instance->Configured) {
+    if (McastIp != NULL) {
+      FreePool (McastIp);
+    }
     return EFI_NOT_STARTED;
   }
 
   Ip      = Instance->IpInfo->Ip.Ip6;
 
-- 
1.9.5.msysgit.1

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