X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fwrite_tsdb.c;h=2bd27072398541c124016f1c6e97fc8c26936726;hb=21ab7512825cf8177d5eee5101344b45d0854610;hp=c562596b6d753525aafa663ee532d71bcec5d873;hpb=43ef00c0eb99991902d3c9a5fbe582cde049b055;p=collectd.git diff --git a/src/write_tsdb.c b/src/write_tsdb.c index c562596b..2bd27072 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -48,7 +48,6 @@ #include "utils_cache.h" -#include #include #ifndef WT_DEFAULT_NODE @@ -142,7 +141,7 @@ static int wt_flush_nolock(cdtime_t timeout, struct wt_callback *cb) return 0; } - if (cb->send_buf_fill <= 0) + if (cb->send_buf_fill == 0) { cb->send_buf_init_time = cdtime(); return 0; @@ -579,13 +578,12 @@ static int wt_config_tsd(oconfig_item_t *ci) char callback_name[DATA_MAX_NAME_LEN]; int i; - cb = malloc(sizeof(*cb)); + cb = calloc(1, sizeof(*cb)); if (cb == NULL) { - ERROR("write_tsdb plugin: malloc failed."); + ERROR("write_tsdb plugin: calloc failed."); return -1; } - memset(cb, 0, sizeof(*cb)); cb->sock_fd = -1; cb->node = NULL; cb->service = NULL;