REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2530
The Suite pointer is used before check if it is valid,
correct it to check the validation before use.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
UNIT_TEST *Test;\r
UNIT_TEST_FRAMEWORK *ParentFramework;\r
\r
- TestEntry = NULL;\r
- ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;\r
-\r
if (Suite == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ TestEntry = NULL;\r
+ ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;\r
+\r
DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));\r
DEBUG ((DEBUG_VERBOSE, "RUNNING TEST SUITE: %a\n", Suite->Title));\r
DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));\r
\r
Status = EFI_SUCCESS;\r
Suite = (UNIT_TEST_SUITE *)SuiteHandle;\r
- ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;\r
\r
//\r
// First, let's check to make sure that our parameters look good.\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;\r
//\r
// Create the new entry.\r
NewTestEntry = AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY ));\r