X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fwrite_riemann.c;h=5c59c92e4c50341c27fcb380188363685783d5d6;hb=70ea9457f76d6cd953f2cbd64eeda0ff265f47db;hp=a67f94cc62732972421a4d85196cdce012916bc3;hpb=88f22ff8b4c69eb38b6aaab30df212df1871d4ec;p=collectd.git diff --git a/src/write_riemann.c b/src/write_riemann.c index a67f94cc..5c59c92e 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -33,7 +33,6 @@ #include "utils_cache.h" #include "riemann.pb-c.h" -#include #include #include #include @@ -619,7 +618,7 @@ static Msg *riemann_value_list_to_protobuf (struct riemann_host const *host, /* msg__init (msg); /* Set up events. First, the list of pointers. */ - msg->n_events = (size_t) vl->values_len; + msg->n_events = vl->values_len; msg->events = calloc (msg->n_events, sizeof (*msg->events)); if (msg->events == NULL) { @@ -789,6 +788,8 @@ static int riemann_write(const data_set_t *ds, /* {{{ */ status = write_riemann_threshold_check(ds, vl, statuses); if (status != 0) return status; + } else { + memset (statuses, 0, sizeof (statuses)); } if (host->use_tcp == 1 && host->batch_mode) { @@ -1049,6 +1050,7 @@ static int riemann_config(oconfig_item_t *ci) /* {{{ */ } if ((val = strdup(child->values[1].value.string)) == NULL) { WARNING("cannot allocate memory for attribute value."); + sfree (key); return (-1); } strarray_add(&riemann_attrs, &riemann_attrs_num, key);