X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fwrite_mongodb.c;h=44181e9387b9363c3518bb9f957579f773a70b4e;hb=4d3d0c9713859c9edd7cd88b5ef786e3630a846c;hp=66dc8e07404cc8093a84c453cdb3bfd4f3272c18;hpb=9eb3efd17e10c3bd59aa227d8d11fe60d6d4f303;p=collectd.git diff --git a/src/write_mongodb.c b/src/write_mongodb.c index 66dc8e07..44181e93 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -171,7 +171,7 @@ static int wm_initialize(wm_node_t *node) /* {{{ */ uri_length = strlen(format_string) + strlen(node->user) + strlen(node->passwd) + strlen(node->host) + 5 + strlen(node->db) + 1; - if ((uri = calloc(sizeof(char), uri_length)) == NULL) { + if ((uri = calloc(1, uri_length)) == NULL) { ERROR("write_mongodb plugin: Not enough memory to assemble " "authentication string."); mongoc_client_destroy(node->client); @@ -196,7 +196,7 @@ static int wm_initialize(wm_node_t *node) /* {{{ */ } else { format_string = "mongodb://%s:%d"; uri_length = strlen(format_string) + strlen(node->host) + 5 + 1; - if ((uri = calloc(sizeof(char), uri_length)) == NULL) { + if ((uri = calloc(1, uri_length)) == NULL) { ERROR("write_mongodb plugin: Not enough memory to assemble " "authentication string."); mongoc_client_destroy(node->client);