parseDS(argv[i] + 3, rrd.ds_def + rrd.stat_head->ds_cnt,
&rrd, lookup_DS, &m, &require_version);
- mappings =
+ mapping_t *mappings_tmp =
realloc(mappings, sizeof(mapping_t) * (mappings_cnt + 1));
- if (!mappings) {
+ if (!mappings_tmp) {
rrd_set_error("allocating mappings");
goto done;
}
+ mappings = mappings_tmp;
memcpy(mappings + mappings_cnt, &m, sizeof(mapping_t));
mappings_cnt++;
(void *) target);
}
- candidates = realloc(candidates,
- sizeof(candidate_t) * (cnt +
- candidate_cnt_for_source));
- if (candidates == NULL) {
+ candidate_t *candidates_tmp = realloc(candidates,
+ sizeof(candidate_t) *
+ (cnt +
+ candidate_cnt_for_source));
+ if (candidates_tmp == NULL) {
rrd_set_error("Cannot realloc memory");
free(candidates_for_source);
goto done;
}
+ candidates = candidates_tmp;
memcpy(candidates + cnt,
candidates_for_source,
sizeof(candidate_t) * candidate_cnt_for_source);
rc = syntax_error(sock, cmd);
goto done;
}
- sources = realloc(sources, sizeof(char *) * (sources_length + 2));
- if (sources == NULL) {
+ char **sources_tmp =
+ realloc(sources, sizeof(char *) * (sources_length + 2));
+ if (sources_tmp == NULL) {
rc = send_response(sock, RESP_ERR,
"Cannot allocate memory\n");
goto done;
}
+ sources = sources_tmp;
flush_file(tok);
sources[sources_length++] = tok;