diff options
author | Zhang Lubo <lubo.zhang@intel.com> | 2016-06-21 14:40:28 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-06-23 09:27:14 +0800 |
commit | 7c275b3cde5fdc3cf6fac068c52455927d09c1c1 (patch) | |
tree | 89f56e3ba6f93ceb5081d062be7430ef7acce000 /NetworkPkg/IScsiDxe/IScsiConfig.c | |
parent | 3460c75dfe951c50d1d16eb2bb54b4790d49a91d (diff) | |
download | edk2-7c275b3cde5fdc3cf6fac068c52455927d09c1c1.tar.gz edk2-7c275b3cde5fdc3cf6fac068c52455927d09c1c1.tar.bz2 edk2-7c275b3cde5fdc3cf6fac068c52455927d09c1c1.zip |
NetworkPkg: Replace ASSERT with error handling in Http boot and IScsi
v2:
*Fix some memory leak issue.
This patch is used to replace ASSERT with error handling in Http boot
Driver and IScsi driver.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'NetworkPkg/IScsiDxe/IScsiConfig.c')
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiConfig.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c index a82ce231e8..8015e3de53 100644 --- a/NetworkPkg/IScsiDxe/IScsiConfig.c +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c @@ -1987,7 +1987,11 @@ IScsiFormExtractConfig ( ConfigRequestHdr = HiiConstructConfigHdr (&gIScsiConfigGuid, mVendorStorageName, Private->DriverHandle);
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
ConfigRequest = AllocateZeroPool (Size);
- ASSERT (ConfigRequest != NULL);
+ if (ConfigRequest == NULL) {
+ FreePool (IfrNvData);
+ FreePool (InitiatorName);
+ return EFI_OUT_OF_RESOURCES;
+ }
AllocatedRequest = TRUE;
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
FreePool (ConfigRequestHdr);
|