X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fapache.c;h=2e91a1bee3b6f4311b178e6472350496853f3ec1;hb=2a28b85efff687d0753d816fcf89f6be01605db5;hp=38035caa22e94cfdeeaac8ef1047ddf443a40fdd;hpb=5c2993e4121feae745551be182221b31bc23ff97;p=collectd.git diff --git a/src/apache.c b/src/apache.c index 38035caa..2e91a1be 100644 --- a/src/apache.c +++ b/src/apache.c @@ -98,14 +98,14 @@ 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) { char *temp; - temp = (char *) realloc (st->apache_buffer, + temp = realloc (st->apache_buffer, st->apache_buffer_fill + len + 1); if (temp == NULL) { @@ -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;