From 8b9dcbf792bf327db71e985ea5206438b35b9887 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 9 Jun 2020 13:03:06 -0500 Subject: [PATCH] Low: tools: verify newly created CIB connection is not NULL In practice it couldn't get out of cib_new_variant() with NULLs, but this makes static analysis happy. --- tools/crm_resource.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/crm_resource.c b/tools/crm_resource.c index 52ed9cb232a..6853ad5330e 100644 --- a/tools/crm_resource.c +++ b/tools/crm_resource.c @@ -1101,6 +1101,10 @@ main(int argc, char **argv) // Establish a connection to the CIB cib_conn = cib_new(); + if ((cib_conn == NULL) || (cib_conn->cmds == NULL)) { + CMD_ERR("Could not create CIB connection: %s", pcmk_strerror(rc)); + goto bail; + } rc = cib_conn->cmds->signon(cib_conn, crm_system_name, cib_command); if (rc != pcmk_ok) { CMD_ERR("Could not connect to the CIB: %s", pcmk_strerror(rc));