Ver Fonte

Add calls to missing object_find_destroy() to fix mem leaks

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Angus Salkeld há 14 anos atrás
pai
commit
816513d3ef
4 ficheiros alterados com 12 adições e 2 exclusões
  1. 6 0
      exec/main.c
  2. 4 2
      exec/service.c
  3. 1 0
      exec/totemconfig.c
  4. 1 0
      services/votequorum.c

+ 6 - 0
exec/main.c

@@ -386,6 +386,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)
@@ -409,6 +410,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 (
@@ -778,6 +780,8 @@ static void corosync_totem_stats_init (void)
 			sizeof (zero_64), OBJDB_VALUETYPE_UINT64);
 
 	}
+	objdb->object_find_destroy (object_find_handle);
+
 	/* start stats timer */
 	api->timer_add_duration (1500 * MILLI_2_NANO_SECONDS, NULL,
 		corosync_totem_stats_updater,
@@ -1288,6 +1292,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,
@@ -1320,6 +1325,7 @@ static void corosync_stats_init (void)
 			&object_runtime_handle) != 0) {
 		return;
 	}
+	objdb->object_find_destroy (object_find_handle);
 
 	/* Connection objects */
 	objdb->object_create (object_runtime_handle,

+ 4 - 2
exec/service.c

@@ -497,9 +497,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",

+ 1 - 0
exec/totemconfig.c

@@ -409,6 +409,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);

+ 1 - 0
services/votequorum.c

@@ -1650,6 +1650,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);
 	}
 }