HomeClusterLabs Projects

Refactor: tools: Move teardown call to delete function in crm_shadow

Description

Refactor: tools: Move teardown call to delete function in crm_shadow

I believe the existing code was fine, but Coverity complained:

crm_shadow.c:1196: assign_zero: Assigning: "out" = "NULL".
crm_shadow.c:1209: path: Condition

!g_option_context_parse_strv(context, &processed_args, &error)",
taking true branch.

crm_shadow.c:1211: path: Jumping to label "done".
crm_shadow.c:1318: path: Condition "needs_teardown", taking true branch.
crm_shadow.c:1320: var_deref_model: Passing null pointer "out" to

"shadow_teardown", which dereferences it.

This couldn't have happened, because needs_teardown could not have been
true.

However, since some recent cleanup of the callers of shadow_teardown(),
we don't need to do the teardown in main() anymore. It won't be called
if the GError is set, so we don't have to worry about printing the
teardown messages after any errors (if that had even made sense in the
first place).

This will also facilitate the move to libpacemaker.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Mar 14 2023, 4:14 AM
Parents
rPe9df93409b5a: Test: cts-cli: Add tests for crm_shadow --output-as=xml
Branches
Unknown
Tags
Unknown