X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_http.c;h=9a4051176bf9c40bba5c9f877d838727f9c17283;hb=ff9e11ade5cfabf32c63fb19fc76cbbc4186bc5b;hp=27337813affbc45dc6d9728f41f3427c78e3ac05;hpb=840f4cef30b01a6928832f09daf00890b35f3582;p=collectd.git diff --git a/src/write_http.c b/src/write_http.c index 27337813..9a405117 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."); @@ -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;