while (42)
{
- callback_func_t *cf;
+ read_func_t *rf;
- cf = c_heap_get_root (read_heap);
- if (cf == NULL)
+ rf = c_heap_get_root (read_heap);
+ if (rf == NULL)
break;
-
- destroy_callback (cf);
+ sfree (rf->rf_name);
+ destroy_callback ((callback_func_t *) rf);
}
c_heap_destroy (read_heap);
static void stop_write_threads (void) /* {{{ */
{
write_queue_t *q;
- int i;
+ size_t i;
if (write_threads == NULL)
return;
if (i > 0)
{
- WARNING ("plugin: %i value list%s left after shutting down "
+ WARNING ("plugin: %zu value list%s left after shutting down "
"the write threads.",
i, (i == 1) ? " was" : "s were");
}
rf->rf_interval = plugin_get_interval ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
+ }
return (status);
} /* int plugin_register_read */
rf->rf_ctx = plugin_get_ctx ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
+ }
return (status);
} /* int plugin_register_complex_read */
if (flush_name == NULL)
return (-1);
- cb = (flush_callback_t *)malloc(sizeof(flush_callback_t));
+ cb = malloc(sizeof(flush_callback_t));
if (cb == NULL)
{
ERROR ("plugin_register_flush: malloc failed.");
sfree(flush_name);
- plugin_unregister (list_flush, name);
return (-1);
}
ERROR ("plugin_register_flush: strdup failed.");
sfree(cb);
sfree(flush_name);
- plugin_unregister (list_flush, name);
return (-1);
}
cb->timeout = ctx.flush_timeout;
{
sfree(cb->name);
sfree(cb);
- plugin_unregister (list_flush, name);
return status;
}
}
int plugin_register_data_set (const data_set_t *ds)
{
data_set_t *ds_copy;
- int i;
+ size_t i;
if ((data_sets != NULL)
&& (c_avl_get (data_sets, ds->type, NULL) == 0))
plugin_ctx_t ctx = plugin_get_ctx ();
if (ctx.flush_interval != 0)
- {
+ {
char *flush_name;
flush_name = plugin_flush_callback_name (name);
- if (flush_name == NULL)
- return (-1);
-
- plugin_unregister_read(flush_name);
- sfree(flush_name);
+ if (flush_name != NULL)
+ {
+ plugin_unregister_read(flush_name);
+ sfree(flush_name);
+ }
}
return plugin_unregister (list_flush, name);
return_status = -1;
}
+ sfree (rf->rf_name);
destroy_callback ((void *) rf);
}
if (ds->ds_num != vl->values_len)
{
ERROR ("plugin_dispatch_values: ds->type = %s: "
- "(ds->ds_num = %i) != "
- "(vl->values_len = %i)",
+ "(ds->ds_num = %zu) != "
+ "(vl->values_len = %zu)",
ds->type, ds->ds_num, vl->values_len);
return (-1);
}