From: Jiaxin Wu Date: Fri, 27 Oct 2017 02:16:29 +0000 (+0800) Subject: NetworkPkg/HttpBootDxe: Add check to avoid use NULL pointer X-Git-Tag: edk2-stable201903~3163 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=770f9aae09cb6291db5a28ca2eb1ebf5696e9418 NetworkPkg/HttpBootDxe: Add check to avoid use NULL pointer Cc: Wu Hao A Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Hao Wu --- 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;