X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fapache.c;h=baa6081a6046743679a6949b16d2f07e347aed24;hb=f81aafecc0b537b4bec734f7fdb0c8352719afee;hp=c515e3c5db57a45bc04e706db387d02b5a27ba24;hpb=aedf67e69cbe93a6925fd1004a7c8b990aed4b0a;p=collectd.git diff --git a/src/apache.c b/src/apache.c index c515e3c5..baa6081a 100644 --- a/src/apache.c +++ b/src/apache.c @@ -175,13 +175,12 @@ static int config_add (oconfig_item_t *ci) int i; int status; - st = malloc (sizeof (*st)); + st = calloc (1, sizeof (*st)); if (st == NULL) { - ERROR ("apache plugin: malloc failed."); + ERROR ("apache plugin: calloc failed."); return (-1); } - memset (st, 0, sizeof (*st)); st->timeout = -1; @@ -255,7 +254,7 @@ static int config_add (oconfig_item_t *ci) status = plugin_register_complex_read (/* group = */ NULL, /* name = */ callback_name, /* callback = */ apache_read_host, - /* interval = */ NULL, + /* interval = */ 0, /* user_data = */ &ud); } @@ -383,8 +382,7 @@ static int init_host (apache_t *st) /* {{{ */ if (st->timeout >= 0) curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, (long) st->timeout); else - curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, - CDTIME_T_TO_MS(plugin_get_interval())); + curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, (long) CDTIME_T_TO_MS(plugin_get_interval())); #endif return (0);