summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/HttpBootDxe
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2017-10-27 10:16:29 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2017-10-30 08:51:42 +0800
commit770f9aae09cb6291db5a28ca2eb1ebf5696e9418 (patch)
treede22b90fe609dbc2a8c3cddc63c8509930b3908f /NetworkPkg/HttpBootDxe
parent76fd5a660d704538a1b14a58d03a4eef9682b01c (diff)
downloadedk2-770f9aae09cb6291db5a28ca2eb1ebf5696e9418.tar.gz
edk2-770f9aae09cb6291db5a28ca2eb1ebf5696e9418.tar.bz2
edk2-770f9aae09cb6291db5a28ca2eb1ebf5696e9418.zip
NetworkPkg/HttpBootDxe: Add check to avoid use NULL pointer
Cc: Wu Hao A <hao.a.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Diffstat (limited to 'NetworkPkg/HttpBootDxe')
-rw-r--r--NetworkPkg/HttpBootDxe/HttpBootDxe.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.c b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
index b1f9042ea3..8a61f51cc8 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDxe.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
@@ -615,19 +615,21 @@ HttpBootIp4DxeDriverBindingStart (
return EFI_SUCCESS;
ON_ERROR:
- if (FirstStart) {
- gBS->UninstallProtocolInterface (
- ControllerHandle,
- &gEfiCallerIdGuid,
- &Private->Id
- );
- }
-
- HttpBootDestroyIp4Children (This, Private);
- HttpBootConfigFormUnload (Private);
+ if (Private != NULL) {
+ if (FirstStart) {
+ gBS->UninstallProtocolInterface (
+ ControllerHandle,
+ &gEfiCallerIdGuid,
+ &Private->Id
+ );
+ }
+
+ HttpBootDestroyIp4Children (This, Private);
+ HttpBootConfigFormUnload (Private);
- if (FirstStart && Private != NULL) {
- FreePool (Private);
+ if (FirstStart) {
+ FreePool (Private);
+ }
}
return Status;
@@ -1144,19 +1146,21 @@ HttpBootIp6DxeDriverBindingStart (
return EFI_SUCCESS;
ON_ERROR:
- if (FirstStart) {
- gBS->UninstallProtocolInterface (
- ControllerHandle,
- &gEfiCallerIdGuid,
- &Private->Id
- );
- }
+ if (Private != NULL) {
+ if (FirstStart) {
+ gBS->UninstallProtocolInterface (
+ ControllerHandle,
+ &gEfiCallerIdGuid,
+ &Private->Id
+ );
+ }
- HttpBootDestroyIp6Children(This, Private);
- HttpBootConfigFormUnload (Private);
+ HttpBootDestroyIp6Children(This, Private);
+ HttpBootConfigFormUnload (Private);
- if (FirstStart && Private != NULL) {
- FreePool (Private);
+ if (FirstStart) {
+ FreePool (Private);
+ }
}
return Status;