[corosync] [PATCH 3/7] Add calls to missing object_find_destroy() to fix mem leaks

Angus Salkeld asalkeld at redhat.com
Thu Nov 10 10:54:52 GMT 2011


Signed-off-by: Angus Salkeld <asalkeld at redhat.com>
---
 exec/ipc_glue.c          |    1 +
 exec/main.c              |    7 +++++++
 exec/service.c           |    6 ++++--
 exec/totemconfig.c       |    1 +
 services/votequorum.c    |    1 +
 tools/corosync-notifyd.c |    1 +
 6 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c
index d6ca20d..2bfa9b4 100644
--- a/exec/ipc_glue.c
+++ b/exec/ipc_glue.c
@@ -898,5 +898,6 @@ void cs_ipcs_init(void)
 	api->object_key_create_typed (object_connection_handle,
 		"closed", &zero_64, sizeof (zero_64),
 		OBJDB_VALUETYPE_UINT64);
+	api->object_find_destroy (object_find_handle);
 }
 
diff --git a/exec/main.c b/exec/main.c
index e2ab979..4f557ad 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -388,6 +388,7 @@ static void member_object_joined (unsigned int nodeid)
 			"joined", strlen("joined"),
 			OBJDB_VALUETYPE_STRING);
 	}
+	objdb->object_find_destroy (object_find_handle);
 }
 
 static void member_object_left (unsigned int nodeid)
@@ -411,6 +412,7 @@ static void member_object_left (unsigned int nodeid)
 			"status", strlen("status"),
 			"left", strlen("left"));
 	}
+	objdb->object_find_destroy (object_find_handle);
 }
 
 static void confchg_fn (
@@ -762,6 +764,7 @@ static void corosync_totem_dynamic_init (void)
 		&object_totem_handle) != 0) {
 		return;
 	}
+	api->object_find_destroy (object_find_handle);
 
 	if (objdb->object_find_create(object_totem_handle,
 		"interface", strlen("interface"), &object_find_handle) != 0) {
@@ -775,6 +778,7 @@ static void corosync_totem_dynamic_init (void)
 
 		return;
 	}
+	api->object_find_destroy (object_find_handle);
 
 	/*
 	 * create new child object: dynamic
@@ -926,6 +930,8 @@ static void corosync_totem_stats_init (void)
 			sizeof (zero_32), OBJDB_VALUETYPE_UINT32);
 
 	}
+	objdb->object_find_destroy (object_find_handle);
+
 	/* start stats timer */
 	api->timer_add_duration (1500 * MILLI_2_NANO_SECONDS, NULL,
 		corosync_totem_stats_updater,
@@ -1207,6 +1213,7 @@ static void corosync_fplay_control_init (void)
 			&object_runtime_handle) != 0) {
 		return;
 	}
+	objdb->object_find_destroy (object_find_handle);
 
 	objdb->object_create (object_runtime_handle,
 		&object_blackbox_handle,
diff --git a/exec/service.c b/exec/service.c
index 2b6fa35..3e3b1b3 100644
--- a/exec/service.c
+++ b/exec/service.c
@@ -519,9 +519,11 @@ unsigned int corosync_service_defaults_link_and_init (struct corosync_api_v1 *co
 			&object_runtime_handle) == 0) {
 
 		corosync_api->object_create (object_runtime_handle,
-									 &object_stats_services_handle,
-									 "services", strlen ("services"));
+			&object_stats_services_handle,
+			"services", strlen ("services"));
 	}
+	corosync_api->object_find_destroy (object_find2_handle);
+
 	corosync_api->object_create (OBJECT_PARENT_HANDLE,
 		&object_internal_configuration_handle,
 		"internal_configuration",
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index 8ce8def..a74017a 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -421,6 +421,7 @@ printf ("couldn't find totem handle\n");
 		}
 		totem_config->interfaces[ringnumber].member_count = member_count;
 		totem_config->interface_count++;
+		objdb->object_find_destroy (object_find_member_handle);
 	}
 
 	objdb->object_find_destroy (object_find_interface_handle);
diff --git a/services/votequorum.c b/services/votequorum.c
index 602dfe7..013e191 100644
--- a/services/votequorum.c
+++ b/services/votequorum.c
@@ -1648,6 +1648,7 @@ static void votequorum_objdb_reload_notify(
 		else {
 			log_printf(LOGSYS_LEVEL_ERROR, "votequorum objdb tracking stopped, cannot find quorum{} handle in objdb\n");
 		}
+		corosync_api->object_find_destroy(find_handle);
 	}
 }
 
diff --git a/tools/corosync-notifyd.c b/tools/corosync-notifyd.c
index 72c5827..767c949 100644
--- a/tools/corosync-notifyd.c
+++ b/tools/corosync-notifyd.c
@@ -351,6 +351,7 @@ _cs_confdb_find_object (confdb_handle_t handle,
 		if (res != CS_OK) {
 			return res;
 		}
+		confdb_object_find_destroy(handle, parent_object_handle);
 
 		parent_object_handle = obj_handle;
 		obj_name_pt = strtok_r (NULL, SEPERATOR_STR, &save_pt);
-- 
1.7.7



More information about the discuss mailing list