Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
pacemaker.34782
bsc#1211678-0007-Low-tools-avoid-insignificant-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1211678-0007-Low-tools-avoid-insignificant-memory-leaks.patch of Package pacemaker.34782
From bee54eba4d9c28d3a7907a3e13a5deeee6bc0916 Mon Sep 17 00:00:00 2001 From: Ken Gaillot <kgaillot@redhat.com> Date: Tue, 27 Jul 2021 11:01:04 -0500 Subject: [PATCH 7/8] Low: tools: avoid (insignificant) memory leaks detected by valgrind --- tools/crmadmin.c | 2 ++ tools/crm_diff.c | 2 +- tools/crm_resource.c | 33 +++++++++++++++++----------- tools/crm_resource_ban.c | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) Index: pacemaker-2.0.5+20201202.ba59be712/tools/crmadmin.c =================================================================== --- pacemaker-2.0.5+20201202.ba59be712.orig/tools/crmadmin.c +++ pacemaker-2.0.5+20201202.ba59be712/tools/crmadmin.c @@ -350,6 +350,7 @@ list_nodes() } rc = the_cib->cmds->signon(the_cib, crm_system_name, cib_command); if (rc != pcmk_ok) { + cib_delete(the_cib); return pcmk_legacy2rc(rc); } @@ -360,6 +361,7 @@ list_nodes() free_xml(output); } the_cib->cmds->signoff(the_cib); + cib_delete(the_cib); return pcmk_legacy2rc(rc); } Index: pacemaker-2.0.5+20201202.ba59be712/tools/crm_diff.c =================================================================== --- pacemaker-2.0.5+20201202.ba59be712.orig/tools/crm_diff.c +++ pacemaker-2.0.5+20201202.ba59be712/tools/crm_diff.c @@ -395,5 +395,5 @@ done: free(options.xml_file_2); free_xml(object_1); free_xml(object_2); - return crm_errno2exit(rc); + crm_exit(crm_errno2exit(rc)); } Index: pacemaker-2.0.5+20201202.ba59be712/tools/crm_resource.c =================================================================== --- pacemaker-2.0.5+20201202.ba59be712.orig/tools/crm_resource.c +++ pacemaker-2.0.5+20201202.ba59be712/tools/crm_resource.c @@ -1044,6 +1044,8 @@ clear_constraints(xmlNodePtr *cib_xml_co g_set_error(&error, PCMK__RC_ERROR, rc, "Could not get modified CIB: %s\n", pcmk_strerror(rc)); g_list_free(before); + free_xml(*cib_xml_copy); + *cib_xml_copy = NULL; return rc; } @@ -1237,28 +1239,33 @@ populate_working_set(xmlNodePtr *cib_xml if (options.xml_file != NULL) { *cib_xml_copy = filename2xml(options.xml_file); + if (*cib_xml_copy == NULL) { + rc = pcmk_rc_cib_corrupt; + } } else { rc = cib_conn->cmds->query(cib_conn, NULL, cib_xml_copy, cib_scope_local | cib_sync_call); rc = pcmk_legacy2rc(rc); } - if(rc != pcmk_rc_ok) { - return rc; + if (rc == pcmk_rc_ok) { + data_set = pe_new_working_set(); + if (data_set == NULL) { + rc = ENOMEM; + } else { + pe__set_working_set_flags(data_set, + pe_flag_no_counts|pe_flag_no_compat); + rc = update_working_set_xml(data_set, cib_xml_copy); + } } - /* Populate the working set instance */ - data_set = pe_new_working_set(); - if (data_set == NULL) { - rc = ENOMEM; + if (rc != pcmk_rc_ok) { + free_xml(*cib_xml_copy); + *cib_xml_copy = NULL; return rc; } - pe__set_working_set_flags(data_set, pe_flag_no_counts|pe_flag_no_compat); - rc = update_working_set_xml(data_set, cib_xml_copy); - if (rc == pcmk_rc_ok) { - cluster_status(data_set); - } - return rc; + cluster_status(data_set); + return pcmk_rc_ok; } static int Index: pacemaker-2.0.5+20201202.ba59be712/tools/crm_resource_ban.c =================================================================== --- pacemaker-2.0.5+20201202.ba59be712.orig/tools/crm_resource_ban.c +++ pacemaker-2.0.5+20201202.ba59be712/tools/crm_resource_ban.c @@ -277,7 +277,7 @@ resource_clear_node_in_location(const ch rc = pcmk_legacy2rc(rc); } - free(fragment); + free_xml(fragment); return rc; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor