1589a3e7c3
- Resolve coverity RESOURCE_LEAK, REVERSE_INULL and UNREACHABLE defects - Tools: crm_simulate - Support to grant/revoke/standby/activate tickets from the new ticket state section (bnc#752241) - Tools: Add crm_ticket to be profiled by valgrind - Tools: crm_ticket - Display the tickets that are referenced in rsc_ticket constraints but have never been granted yet (bnc#752241) - Tools: crm_mon - Support to display tickets (bnc#752242) - PE: Move the ticket state section to "/cib/status/tickets/ticket_state" (bnc#752241) - PE: Support to make tickets standby for relinquishing tickets gracefully (bnc#752241) - Tools: Implement a new crm_ticket (bnc#752241) - Tools: Update CLI regression tests for the new crm_ticket - Tools: Add CLI regression tests for ticket standby state - PE: Update regression tests for the new ticket state section - PE: Support to make tickets standby for relinquishing tickets gracefully (regression tests) - Tools: crm_ticket - Granting/revoking tickets need user to confirm unless "--force" option is used (bnc#752269) - Tools: Implement the support of granting/revoking tickets for crm_simulate (bnc#752241) OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=34
77 lines
2.5 KiB
Diff
77 lines
2.5 KiB
Diff
commit 54001929bb3faf05d25176cdc84097ec5fa0979f
|
|
Author: Gao,Yan <ygao@suse.com>
|
|
Date: Mon Mar 26 12:22:32 2012 +0800
|
|
|
|
High: Resolve coverity RESOURCE_LEAK, REVERSE_INULL and UNREACHABLE defects
|
|
|
|
diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c
|
|
index 4a8a20f..3485f78 100644
|
|
--- a/lib/pengine/unpack.c
|
|
+++ b/lib/pengine/unpack.c
|
|
@@ -548,10 +548,12 @@ get_ticket_state_legacy(gpointer key, gpointer value, gpointer user_data)
|
|
}
|
|
|
|
if (ticket_id == NULL || strlen(ticket_id) == 0) {
|
|
+ crm_free(state_key);
|
|
return;
|
|
}
|
|
|
|
if (state_key == NULL || strlen(state_key) == 0) {
|
|
+ crm_free(state_key);
|
|
return;
|
|
}
|
|
|
|
@@ -559,6 +561,7 @@ get_ticket_state_legacy(gpointer key, gpointer value, gpointer user_data)
|
|
if (ticket == NULL) {
|
|
ticket = ticket_new(ticket_id, data_set);
|
|
if (ticket == NULL) {
|
|
+ crm_free(state_key);
|
|
return;
|
|
}
|
|
}
|
|
diff --git a/tools/crm_ticket.c b/tools/crm_ticket.c
|
|
index e822de4..aec9e98 100644
|
|
--- a/tools/crm_ticket.c
|
|
+++ b/tools/crm_ticket.c
|
|
@@ -308,7 +308,7 @@ find_ticket_state_attr_legacy(cib_t * the_cib, const char *attr, const char *tic
|
|
|
|
if (attr_name) {
|
|
const char *attr_prefix = NULL;
|
|
- const char *long_key = NULL;
|
|
+ char *long_key = NULL;
|
|
|
|
if (crm_str_eq(attr_name, "granted", TRUE)) {
|
|
attr_prefix = "granted-ticket";
|
|
@@ -321,6 +321,8 @@ find_ticket_state_attr_legacy(cib_t * the_cib, const char *attr, const char *tic
|
|
offset += snprintf(xpath_string + offset, xpath_max - offset, " and ");
|
|
}
|
|
offset += snprintf(xpath_string + offset, xpath_max - offset, "@name=\"%s\"", long_key);
|
|
+
|
|
+ crm_free(long_key);
|
|
}
|
|
offset += snprintf(xpath_string + offset, xpath_max - offset, "]");
|
|
|
|
@@ -763,6 +765,13 @@ main(int argc, char **argv)
|
|
set_working_set_defaults(&data_set);
|
|
|
|
cib_conn = cib_new();
|
|
+ if (cib_conn == NULL) {
|
|
+ rc = cib_connection;
|
|
+ CMD_ERR("Error initiating the connection to the CIB service: %s\n",
|
|
+ cib_error2string(rc));
|
|
+ return rc;
|
|
+ }
|
|
+
|
|
rc = cib_conn->cmds->signon(cib_conn, crm_system_name, cib_command);
|
|
if (rc != cib_ok) {
|
|
CMD_ERR("Error signing on to the CIB service: %s\n", cib_error2string(rc));
|
|
@@ -933,7 +942,7 @@ main(int argc, char **argv)
|
|
|
|
ticket = find_ticket(ticket_id, &data_set);
|
|
if (ticket == NULL) {
|
|
- return cib_NOTEXISTS;
|
|
+ rc = cib_NOTEXISTS;
|
|
goto bail;
|
|
}
|
|
|