projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added missing include of "collectd.h"
[collectd.git]
/
src
/
write_http.c
diff --git
a/src/write_http.c
b/src/write_http.c
index
c391e69
..
87e518b
100644
(file)
--- a/
src/write_http.c
+++ b/
src/write_http.c
@@
-637,6
+637,12
@@
static int wh_config_node(oconfig_item_t *ci) /* {{{ */
cb->data_ttl = 0;
cb->metrics_prefix = strdup(WRITE_HTTP_DEFAULT_PREFIX);
cb->data_ttl = 0;
cb->metrics_prefix = strdup(WRITE_HTTP_DEFAULT_PREFIX);
+ if (cb->metrics_prefix == NULL) {
+ ERROR("write_http plugin: strdup failed.");
+ sfree(cb);
+ return -1;
+ }
+
pthread_mutex_init(&cb->send_lock, /* attr = */ NULL);
cf_util_get_string(ci, &cb->name);
pthread_mutex_init(&cb->send_lock, /* attr = */ NULL);
cf_util_get_string(ci, &cb->name);
@@
-779,6
+785,9
@@
static int wh_config_node(oconfig_item_t *ci) /* {{{ */
return -1;
}
return -1;
}
+ if (strlen(cb->metrics_prefix) == 0)
+ sfree(cb->metrics_prefix);
+
if (cb->low_speed_limit > 0)
cb->low_speed_time = CDTIME_T_TO_TIME_T(plugin_get_interval());
if (cb->low_speed_limit > 0)
cb->low_speed_time = CDTIME_T_TO_TIME_T(plugin_get_interval());