From: Hao Wu Date: Thu, 28 Jun 2018 01:12:52 +0000 (+0800) Subject: MdeModulePkg/AtaPassThru: Add missing NULL ptr check in BindingStart X-Git-Tag: edk2-stable201903~1462 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=d374f2cdf9ac9af719ebf1fc522620beff487cbb MdeModulePkg/AtaPassThru: Add missing NULL ptr check in BindingStart REF:https://bugzilla.tianocore.org/show_bug.cgi?id=916 Within function AtaAtapiPassThruStart(): Add missing NULL pointer check for variable 'Instance' under the 'ErrorExit' code logic. Cc: Steven Shi Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu Reviewed-by: Star Zeng --- diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c index aab704bcd3..4108bafd85 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c @@ -827,12 +827,11 @@ ErrorExit: gBS->CloseEvent (Instance->TimerEvent); } - // - // Remove all inserted ATA devices. - // - DestroyDeviceInfoList(Instance); - if (Instance != NULL) { + // + // Remove all inserted ATA devices. + // + DestroyDeviceInfoList (Instance); FreePool (Instance); } return EFI_UNSUPPORTED;