projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
all plugins: remove pthread.h include
[collectd.git]
/
src
/
collectd-tg.c
diff --git
a/src/collectd-tg.c
b/src/collectd-tg.c
index
9bd65bc
..
23257fd
100644
(file)
--- a/
src/collectd-tg.c
+++ b/
src/collectd-tg.c
@@
-156,13
+156,12
@@
static lcc_value_list_t *create_value_list (void) /* {{{ */
lcc_value_list_t *vl;
int host_num;
lcc_value_list_t *vl;
int host_num;
- vl =
malloc (
sizeof (*vl));
+ vl =
calloc (1,
sizeof (*vl));
if (vl == NULL)
{
if (vl == NULL)
{
- fprintf (stderr, "
m
alloc failed.\n");
+ fprintf (stderr, "
c
alloc failed.\n");
return (NULL);
}
return (NULL);
}
- memset (vl, 0, sizeof (*vl));
vl->values = calloc (/* nmemb = */ 1, sizeof (*vl->values));
if (vl->values == NULL)
vl->values = calloc (/* nmemb = */ 1, sizeof (*vl->values));
if (vl->values == NULL)
@@
-201,6
+200,7
@@
static lcc_value_list_t *create_value_list (void) /* {{{ */
strncpy (vl->identifier.type,
(vl->values_types[0] == LCC_TYPE_GAUGE) ? "gauge" : "derive",
sizeof (vl->identifier.type));
strncpy (vl->identifier.type,
(vl->values_types[0] == LCC_TYPE_GAUGE) ? "gauge" : "derive",
sizeof (vl->identifier.type));
+ vl->identifier.type[sizeof (vl->identifier.type) - 1] = 0;
snprintf (vl->identifier.type_instance, sizeof (vl->identifier.type_instance),
"ti%li", random ());
snprintf (vl->identifier.type_instance, sizeof (vl->identifier.type_instance),
"ti%li", random ());
@@
-367,7
+367,7
@@
int main (int argc, char **argv) /* {{{ */
else
{
lcc_server_t *srv;
else
{
lcc_server_t *srv;
-
+
srv = lcc_server_create (net, conf_destination, conf_service);
if (srv == NULL)
{
srv = lcc_server_create (net, conf_destination, conf_service);
if (srv == NULL)
{