X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fwrite_http.c;h=c817749f0b0bd93cec839176972d63ceb8a7e490;hb=09c12e0e1e0ef340a7074146684650ed54cba64d;hp=ec3a01ce228aeb7798a611333b90fdb9d2b4630d;hpb=daebbbee0ac53d39a0486aeb8c41fd358f46ed82;p=collectd.git diff --git a/src/write_http.c b/src/write_http.c index ec3a01ce..c817749f 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -183,7 +183,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."); @@ -549,13 +549,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;