projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
write_http: in cleanup handler free http headers
[collectd.git]
/
src
/
plugin.c
diff --git
a/src/plugin.c
b/src/plugin.c
index
6c7aa05
..
73ec77a
100644
(file)
--- a/
src/plugin.c
+++ b/
src/plugin.c
@@
-181,13
+181,13
@@
static void destroy_read_heap (void) /* {{{ */
while (42)
{
while (42)
{
-
callback_func_t *c
f;
+
read_func_t *r
f;
-
c
f = c_heap_get_root (read_heap);
- if (
c
f == NULL)
+
r
f = c_heap_get_root (read_heap);
+ if (
r
f == NULL)
break;
break;
-
- destroy_callback (
c
f);
+ sfree (rf->rf_name);
+ destroy_callback (
(callback_func_t *) r
f);
}
c_heap_destroy (read_heap);
}
c_heap_destroy (read_heap);
@@
-339,7
+339,7
@@
static int plugin_load_file (char *file, uint32_t flags)
ssnprintf (errbuf, sizeof (errbuf),
"lt_dlopen (\"%s\") failed: %s. "
ssnprintf (errbuf, sizeof (errbuf),
"lt_dlopen (\"%s\") failed: %s. "
- "The most common cause for this problem
are
"
+ "The most common cause for this problem
is
"
"missing dependencies. Use ldd(1) to check "
"the dependencies of the plugin "
"/ shared object.",
"missing dependencies. Use ldd(1) to check "
"the dependencies of the plugin "
"/ shared object.",
@@
-870,7
+870,7
@@
static int plugin_mark_loaded (char const *name)
return (status);
}
return (status);
}
-static void plugin_free_loaded ()
+static void plugin_free_loaded (
void
)
{
void *key;
void *value;
{
void *key;
void *value;
@@
-895,7
+895,6
@@
int plugin_load (char const *plugin_name, uint32_t flags)
const char *dir;
char filename[BUFSIZE] = "";
char typename[BUFSIZE];
const char *dir;
char filename[BUFSIZE] = "";
char typename[BUFSIZE];
- int typename_len;
int ret;
struct stat statbuf;
struct dirent *de;
int ret;
struct stat statbuf;
struct dirent *de;
@@
-935,7
+934,6
@@
int plugin_load (char const *plugin_name, uint32_t flags)
WARNING ("plugin_load: Filename too long: \"%s.so\"", plugin_name);
return (-1);
}
WARNING ("plugin_load: Filename too long: \"%s.so\"", plugin_name);
return (-1);
}
- typename_len = strlen (typename);
if ((dh = opendir (dir)) == NULL)
{
if ((dh = opendir (dir)) == NULL)
{
@@
-947,7
+945,7
@@
int plugin_load (char const *plugin_name, uint32_t flags)
while ((de = readdir (dh)) != NULL)
{
while ((de = readdir (dh)) != NULL)
{
- if (str
ncasecmp (de->d_name, typename, typename_len
))
+ if (str
casecmp (de->d_name, typename
))
continue;
status = ssnprintf (filename, sizeof (filename),
continue;
status = ssnprintf (filename, sizeof (filename),
@@
-1135,8
+1133,10
@@
int plugin_register_read (const char *name,
rf->rf_interval = plugin_get_interval ();
status = plugin_insert_read (rf);
rf->rf_interval = plugin_get_interval ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
sfree (rf);
+ }
return (status);
} /* int plugin_register_read */
return (status);
} /* int plugin_register_read */
@@
-1183,8
+1183,10
@@
int plugin_register_complex_read (const char *group, const char *name,
rf->rf_ctx = plugin_get_ctx ();
status = plugin_insert_read (rf);
rf->rf_ctx = plugin_get_ctx ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
sfree (rf);
+ }
return (status);
} /* int plugin_register_complex_read */
return (status);
} /* int plugin_register_complex_read */
@@
-1456,7
+1458,6
@@
int plugin_unregister_notification (const char *name)
void plugin_init_all (void)
{
char const *chain_name;
void plugin_init_all (void)
{
char const *chain_name;
- long write_threads_num;
llentry_t *le;
int status;
llentry_t *le;
int status;
@@
-1499,8
+1500,6
@@
void plugin_init_all (void)
write_threads_num = 5;
}
write_threads_num = 5;
}
- start_write_threads ((size_t) write_threads_num);
-
if ((list_init == NULL) && (read_heap == NULL))
return;
if ((list_init == NULL) && (read_heap == NULL))
return;
@@
-1536,6
+1535,8
@@
void plugin_init_all (void)
le = le->next;
}
le = le->next;
}
+ start_write_threads ((size_t) write_threads_num);
+
/* Start read-threads */
if (read_heap != NULL)
{
/* Start read-threads */
if (read_heap != NULL)
{
@@
-1603,6
+1604,7
@@
int plugin_read_all_once (void)
return_status = -1;
}
return_status = -1;
}
+ sfree (rf->rf_name);
destroy_callback ((void *) rf);
}
destroy_callback ((void *) rf);
}