]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Fixes to static code analysis hits
authorMaciej Rabeda <maciej.rabeda@linux.intel.com>
Thu, 28 Nov 2019 14:46:06 +0000 (15:46 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 4 Dec 2019 01:16:45 +0000 (01:16 +0000)
Introducing fixes to memory leak issues identified by static code analysis
tool.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
NetworkPkg/Ip4Dxe/Ip4If.c
NetworkPkg/TcpDxe/TcpDispatcher.c

index 4f8393cb36ce93d87a035c2c37113db0a8ec4db1..613b42149cc18da3191428e12f6866796bbf47a6 100644 (file)
@@ -203,6 +203,7 @@ Dhcp6EnqueueRetry (
     //\r
     // Unexpected message type.\r
     //\r
+    FreePool(TxCb);\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
index 53a333037f9445a4240f00bc770a02a0e2e8e976..348f2e076aedaea63ea3c3680140545c144a093b 100644 (file)
@@ -491,9 +491,13 @@ Ip4CreateInterface (
   IP4_INTERFACE             *Interface;\r
   EFI_SIMPLE_NETWORK_MODE   SnpMode;\r
 \r
+  if (Mnp == NULL) {\r
+    return NULL;\r
+  }\r
+\r
   Interface = AllocatePool (sizeof (IP4_INTERFACE));\r
 \r
-  if ((Interface == NULL) || (Mnp == NULL)) {\r
+  if (Interface == NULL) {\r
     return NULL;\r
   }\r
 \r
index 86beaf8cc513a37722131fd0727f2f6964316b01..9ae08ccc1c56e4c4b0c55ff06a968eaab9690a55 100644 (file)
@@ -390,6 +390,7 @@ TcpAttachPcb (
                   );\r
   if (EFI_ERROR (Status)) {\r
     IpIoRemoveIp (IpIo, Tcb->IpInfo);\r
+    FreePool (Tcb);\r
     return Status;\r
   }\r
 \r