summaryrefslogtreecommitdiff
path: root/NetworkPkg/UefiPxeBcDxe
diff options
context:
space:
mode:
authorZhang Lubo <lubo.zhang@intel.com>2016-10-27 15:36:00 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-10-31 10:07:31 +0800
commit92ec8772df33f3c758763adcaf42fd42c8da812c (patch)
tree7fb23666178cbf8984533419acc5eefa868a9f7c /NetworkPkg/UefiPxeBcDxe
parentd115b80b7d31f0c2b5c7438de5258a6d263c4de2 (diff)
downloadedk2-platforms-92ec8772df33f3c758763adcaf42fd42c8da812c.tar.xz
NetworkPkg: Add error handling logic when using AllocateZeroPool
Add error handling logic if failed to apply new memory. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-By: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg/UefiPxeBcDxe')
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
index 45377e3626..eba8e1d27b 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
@@ -1298,8 +1298,9 @@ PxeBcSelectDhcp6Offer (
@param[in] Private The pointer to PXEBC_PRIVATE_DATA.
- @retval EFI_SUCCESS Handled the DHCPv6 offer packet successfully.
- @retval EFI_NO_RESPONSE No response to the following request packet.
+ @retval EFI_SUCCESS Handled the DHCPv6 offer packet successfully.
+ @retval EFI_NO_RESPONSE No response to the following request packet.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
**/
EFI_STATUS
@@ -1325,6 +1326,9 @@ PxeBcHandleDhcp6Offer (
//
if (Cache6->OptList[PXEBC_DHCP6_IDX_DNS_SERVER] != NULL) {
Private->DnsServer = AllocateZeroPool (NTOHS (Cache6->OptList[PXEBC_DHCP6_IDX_DNS_SERVER]->OpLen));
+ if (Private->DnsServer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
CopyMem (Private->DnsServer, Cache6->OptList[PXEBC_DHCP6_IDX_DNS_SERVER]->Data, sizeof (EFI_IPv6_ADDRESS));
}