From 89648826ee0a68a24a71826e32787dc5c935b622 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Wed, 22 Mar 2017 09:22:07 +0800 Subject: NetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint Currently, error handling in IScsiDriverEntryPoint is incorrect. For example, if IScsiCreateAttempts() return error due to the limited max variable size, iSCSI will not unload the configuration entries. Cc: Zhang Lubo Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Zhang Lubo --- NetworkPkg/IScsiDxe/IScsiDriver.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'NetworkPkg') diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c b/NetworkPkg/IScsiDxe/IScsiDriver.c index 269c1ae..2249919 100644 --- a/NetworkPkg/IScsiDxe/IScsiDriver.c +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c @@ -1813,7 +1813,7 @@ IScsiDriverEntryPoint ( // Status = IScsiCreateKeywords (PcdGet8 (PcdMaxIScsiAttemptNumber)); if (EFI_ERROR (Status)) { - goto Error5; + goto Error6; } // @@ -1840,13 +1840,16 @@ IScsiDriverEntryPoint ( return EFI_SUCCESS; Error6: - IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle); + IScsiCleanAttemptVariable (); Error5: - IScsiCleanAttemptVariable (); + IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle); Error4: - FreePool (mPrivate); + if (mPrivate != NULL) { + FreePool (mPrivate); + mPrivate = NULL; + } Error3: gBS->UninstallMultipleProtocolInterfaces ( -- cgit v1.1