projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
plugin: not return -1 if plugin_flush_callback_name fails
[collectd.git]
/
src
/
daemon
/
plugin.c
diff --git
a/src/daemon/plugin.c
b/src/daemon/plugin.c
index
255cccc
..
88a2af4
100644
(file)
--- a/
src/daemon/plugin.c
+++ b/
src/daemon/plugin.c
@@
-1362,12
+1362,11
@@
int plugin_register_flush (const char *name,
if (flush_name == NULL)
return (-1);
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);
if (cb == NULL)
{
ERROR ("plugin_register_flush: malloc failed.");
sfree(flush_name);
- plugin_unregister (list_flush, name);
return (-1);
}
return (-1);
}
@@
-1377,7
+1376,6
@@
int plugin_register_flush (const char *name,
ERROR ("plugin_register_flush: strdup failed.");
sfree(cb);
sfree(flush_name);
ERROR ("plugin_register_flush: strdup failed.");
sfree(cb);
sfree(flush_name);
- plugin_unregister (list_flush, name);
return (-1);
}
cb->timeout = ctx.flush_timeout;
return (-1);
}
cb->timeout = ctx.flush_timeout;
@@
-1397,7
+1395,6
@@
int plugin_register_flush (const char *name,
{
sfree(cb->name);
sfree(cb);
{
sfree(cb->name);
sfree(cb);
- plugin_unregister (list_flush, name);
return status;
}
}
return status;
}
}
@@
-1624,15
+1621,15
@@
int plugin_unregister_flush (const char *name)
plugin_ctx_t ctx = plugin_get_ctx ();
if (ctx.flush_interval != 0)
plugin_ctx_t ctx = plugin_get_ctx ();
if (ctx.flush_interval != 0)
-
{
+ {
char *flush_name;
flush_name = plugin_flush_callback_name (name);
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 plugin_unregister (list_flush, name);