X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fapache.c;h=0db532866ead5f8fef34ebebe12db6e2058ecf2a;hb=fdf8a2725fab0a1b6cfa26f453fcb306dd1ab05e;hp=38035caa22e94cfdeeaac8ef1047ddf443a40fdd;hpb=daebbbee0ac53d39a0486aeb8c41fd358f46ed82;p=collectd.git diff --git a/src/apache.c b/src/apache.c index 38035caa..0db53286 100644 --- a/src/apache.c +++ b/src/apache.c @@ -98,7 +98,7 @@ static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb, return (0); } - if (len <= 0) + if (len == 0) return (len); if ((st->apache_buffer_fill + len) >= st->apache_buffer_size) @@ -137,7 +137,7 @@ static size_t apache_header_callback (void *buf, size_t size, size_t nmemb, return (0); } - if (len <= 0) + if (len == 0) return (len); /* look for the Server header */ @@ -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;