MdeModulePkg/AtaPassThru: Add missing NULL ptr check in BindingStart
authorHao Wu <hao.a.wu@intel.com>
Thu, 28 Jun 2018 01:12:52 +0000 (09:12 +0800)
committerHao Wu <hao.a.wu@intel.com>
Fri, 29 Jun 2018 08:52:43 +0000 (16:52 +0800)
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>
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c

index aab704b..4108baf 100644 (file)
@@ -827,12 +827,11 @@ ErrorExit:
     gBS->CloseEvent (Instance->TimerEvent);\r
   }\r
 \r
-  //\r
-  // Remove all inserted ATA devices.\r
-  //\r
-  DestroyDeviceInfoList(Instance);\r
-\r
   if (Instance != NULL) {\r
+    //\r
+    // Remove all inserted ATA devices.\r
+    //\r
+    DestroyDeviceInfoList (Instance);\r
     FreePool (Instance);\r
   }\r
   return EFI_UNSUPPORTED;\r