X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_http.c;h=8dd37c45ad189e2dfbf4265410d37a5b96382bb6;hb=45f80d3776633246f80b124d958b4e6a2e36b392;hp=27337813affbc45dc6d9728f41f3427c78e3ac05;hpb=840f4cef30b01a6928832f09daf00890b35f3582;p=collectd.git diff --git a/src/write_http.c b/src/write_http.c index 27337813..8dd37c45 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -182,7 +182,7 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */ if (cb->pass != NULL) credentials_size += strlen (cb->pass); - cb->credentials = (char *) malloc (credentials_size); + cb->credentials = malloc (credentials_size); if (cb->credentials == NULL) { ERROR ("curl plugin: malloc failed."); @@ -240,7 +240,7 @@ static int wh_flush_nolock (cdtime_t timeout, wh_callback_t *cb) /* {{{ */ if (cb->format == WH_FORMAT_COMMAND) { - if (cb->send_buffer_fill <= 0) + if (cb->send_buffer_fill == 0) { cb->send_buffer_init_time = cdtime (); return (0); @@ -567,13 +567,12 @@ static int wh_config_node (oconfig_item_t *ci) /* {{{ */ int status = 0; int i; - cb = malloc (sizeof (*cb)); + cb = calloc (1, sizeof (*cb)); if (cb == NULL) { - ERROR ("write_http plugin: malloc failed."); + ERROR ("write_http plugin: calloc failed."); return (-1); } - memset (cb, 0, sizeof (*cb)); cb->verify_peer = 1; cb->verify_host = 1; cb->format = WH_FORMAT_COMMAND;