NetworkPkg: Fixes to static code analysis hits

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>
This commit is contained in:
Maciej Rabeda 2019-11-28 15:46:06 +01:00 committed by mergify[bot]
parent 4d613feee5
commit 4f47eaf945
3 changed files with 7 additions and 1 deletions

View File

@ -203,6 +203,7 @@ Dhcp6EnqueueRetry (
// //
// Unexpected message type. // Unexpected message type.
// //
FreePool(TxCb);
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }

View File

@ -491,9 +491,13 @@ Ip4CreateInterface (
IP4_INTERFACE *Interface; IP4_INTERFACE *Interface;
EFI_SIMPLE_NETWORK_MODE SnpMode; EFI_SIMPLE_NETWORK_MODE SnpMode;
if (Mnp == NULL) {
return NULL;
}
Interface = AllocatePool (sizeof (IP4_INTERFACE)); Interface = AllocatePool (sizeof (IP4_INTERFACE));
if ((Interface == NULL) || (Mnp == NULL)) { if (Interface == NULL) {
return NULL; return NULL;
} }

View File

@ -390,6 +390,7 @@ TcpAttachPcb (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
IpIoRemoveIp (IpIo, Tcb->IpInfo); IpIoRemoveIp (IpIo, Tcb->IpInfo);
FreePool (Tcb);
return Status; return Status;
} }