From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web12.7366.1574952372108437936 for ; Thu, 28 Nov 2019 06:46:13 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: linux.intel.com, ip: , mailfrom: maciej.rabeda@linux.intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2019 06:46:12 -0800 X-IronPort-AV: E=Sophos;i="5.69,253,1571727600"; d="scan'208";a="203451936" Received: from mrabeda-mobl.ger.corp.intel.com ([10.102.8.43]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Nov 2019 06:46:11 -0800 From: "Maciej Rabeda" To: devel@edk2.groups.io Cc: Jiaxin Wu , Siyuan Fu Subject: [PATCH v1 1/1] NetworkPkg: Fixes to static code analysis hits Date: Thu, 28 Nov 2019 15:46:06 +0100 Message-Id: <20191128144606.2040-2-maciej.rabeda@linux.intel.com> X-Mailer: git-send-email 2.24.0.windows.2 In-Reply-To: <20191128144606.2040-1-maciej.rabeda@linux.intel.com> References: <20191128144606.2040-1-maciej.rabeda@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Introducing fixes to memory leak issues identified by static code analysis tool. Cc: Jiaxin Wu Cc: Siyuan Fu Signed-off-by: Maciej Rabeda --- NetworkPkg/Dhcp6Dxe/Dhcp6Io.c | 1 + NetworkPkg/Ip4Dxe/Ip4If.c | 6 +++++- NetworkPkg/TcpDxe/TcpDispatcher.c | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c index 4f8393cb36ce..613b42149cc1 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c @@ -203,6 +203,7 @@ Dhcp6EnqueueRetry ( //=0D // Unexpected message type.=0D //=0D + FreePool(TxCb);=0D return EFI_DEVICE_ERROR;=0D }=0D =0D diff --git a/NetworkPkg/Ip4Dxe/Ip4If.c b/NetworkPkg/Ip4Dxe/Ip4If.c index 53a333037f94..348f2e076aed 100644 --- a/NetworkPkg/Ip4Dxe/Ip4If.c +++ b/NetworkPkg/Ip4Dxe/Ip4If.c @@ -491,9 +491,13 @@ Ip4CreateInterface ( IP4_INTERFACE *Interface;=0D EFI_SIMPLE_NETWORK_MODE SnpMode;=0D =0D + if (Mnp =3D=3D NULL) {=0D + return NULL;=0D + }=0D +=0D Interface =3D AllocatePool (sizeof (IP4_INTERFACE));=0D =0D - if ((Interface =3D=3D NULL) || (Mnp =3D=3D NULL)) {=0D + if (Interface =3D=3D NULL) {=0D return NULL;=0D }=0D =0D diff --git a/NetworkPkg/TcpDxe/TcpDispatcher.c b/NetworkPkg/TcpDxe/TcpDispa= tcher.c index 86beaf8cc513..9ae08ccc1c56 100644 --- a/NetworkPkg/TcpDxe/TcpDispatcher.c +++ b/NetworkPkg/TcpDxe/TcpDispatcher.c @@ -390,6 +390,7 @@ TcpAttachPcb ( );=0D if (EFI_ERROR (Status)) {=0D IpIoRemoveIp (IpIo, Tcb->IpInfo);=0D + FreePool (Tcb);=0D return Status;=0D }=0D =0D --=20 2.24.0.windows.2