summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2018-06-28 09:12:52 +0800
committerHao Wu <hao.a.wu@intel.com>2018-06-29 16:52:43 +0800
commitd374f2cdf9ac9af719ebf1fc522620beff487cbb (patch)
tree8c7ad9b1ad168645207e207f1abac8c73da1c91d
parentf6b0258d25a63ae3d3bc6430abe30fb625abc52a (diff)
downloadedk2-d374f2cdf9ac9af719ebf1fc522620beff487cbb.tar.gz
edk2-d374f2cdf9ac9af719ebf1fc522620beff487cbb.tar.bz2
edk2-d374f2cdf9ac9af719ebf1fc522620beff487cbb.zip
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 <steven.shi@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c9
1 files changed, 4 insertions, 5 deletions
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;