X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftarget_scale.c;h=74652ff81dbeeb6452f0fce8c2d01768e10d3836;hb=edd9af8a874ebc9f2a7f02846807229a648917db;hp=b667ed13ed618ae243b0084ca6778452c42253a8;hpb=1ebf2f31bd2e080e6f42de640f0a3899a61501c0;p=collectd.git diff --git a/src/target_scale.c b/src/target_scale.c index b667ed13..74652ff8 100644 --- a/src/target_scale.c +++ b/src/target_scale.c @@ -328,7 +328,7 @@ static int ts_config_add_data_source(ts_data_t *data, /* {{{ */ /* Allocate space for the char pointers */ new_data_sources_num = data->data_sources_num + ((size_t) ci->values_num); - temp = (char **) realloc (data->data_sources, + temp = realloc (data->data_sources, new_data_sources_num * sizeof (char *)); if (temp == NULL) { @@ -387,13 +387,12 @@ static int ts_create (const oconfig_item_t *ci, void **user_data) /* {{{ */ int status; int i; - data = malloc (sizeof (*data)); + data = calloc (1, sizeof (*data)); if (data == NULL) { - ERROR ("ts_create: malloc failed."); + ERROR ("ts_create: calloc failed."); return (-ENOMEM); } - memset (data, 0, sizeof (*data)); data->factor = NAN; data->offset = NAN;