ASSERT_EQ(orch_dbus_initialize(), ORCH_ERROR_DBUS_FAILURE);
- free(valid_GDBusConnection);
+ if (valid_GDBusConnection != NULL) {
+ free(valid_GDBusConnection);
+ valid_GDBusConnection = NULL;
+ }
}
TEST_F(OrchestrationServerTests, WhenCalledOrchDbusInit_SetNodeInfoNewForXMLFailure_ExpectedErrorReturn)
ASSERT_EQ(orch_dbus_initialize(), ORCH_ERROR_DBUS_FAILURE);
- free(valid_GDBusConnection);
+ if (valid_GDBusConnection != NULL) {
+ free(valid_GDBusConnection);
+ valid_GDBusConnection = NULL;
+ }
}
TEST_F(OrchestrationServerTests, WhenCalledOrchDbusInit_ConnectionRegisterObjectFailure_ExpectedErrorReturn)
ASSERT_EQ(orch_dbus_initialize(), ORCH_ERROR_DBUS_FAILURE);
- free(valid_GDBusConnection);
- free(valid_GDBusNodeInfo);
- free(valid_GDBusinterface);
+ if (valid_GDBusConnection != NULL) {
+ free(valid_GDBusConnection);
+ valid_GDBusConnection = NULL;
+ }
+ if (valid_GDBusNodeInfo != NULL) {
+ free(valid_GDBusNodeInfo);
+ valid_GDBusNodeInfo = NULL;
+ }
+ if (valid_GDBusinterface != NULL) {
+ free(valid_GDBusinterface);
+ valid_GDBusinterface = NULL;
+ }
}
TEST_F(OrchestrationServerTests, WhenCalledServerInit_ExpectedSuccess)
ASSERT_EQ(orchestration_server_initialize(fake_request_cb), ORCH_ERROR_NONE);
- free(valid_GDBusConnection);
- free(valid_GDBusNodeInfo);
+ if (valid_GDBusConnection != NULL) {
+ free(valid_GDBusConnection);
+ valid_GDBusConnection = NULL;
+ }
+ if (valid_GDBusNodeInfo != NULL) {
+ free(valid_GDBusNodeInfo);
+ valid_GDBusNodeInfo = NULL;
+ }
requestCbResult = false;
}
EXPECT_EQ(requestCbResult, false);
- free(valid_GDBusConnection);
- free(valid_GDBusNodeInfo);
+ if (valid_GDBusConnection != NULL) {
+ free(valid_GDBusConnection);
+ valid_GDBusConnection = NULL;
+ }
+ if (valid_GDBusNodeInfo != NULL) {
+ free(valid_GDBusNodeInfo);
+ valid_GDBusNodeInfo = NULL;
+ }
}
int main(int argc, char **argv)