summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5020650)
raw | patch | inline | side by side (parent: 5020650)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 4 Feb 2008 22:34:56 +0000 (22:34 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 4 Feb 2008 22:34:56 +0000 (22:34 +0000) |
program/src/rrd_create.c | patch | blob | history |
index 35a564bfc08411d31bc19f105681a0fb1ceaa20f..a8f6a2967fb1abaf8740e1559008b7a191f3b739 100644 (file)
--- a/program/src/rrd_create.c
+++ b/program/src/rrd_create.c
/* static header */
if ((rrd.stat_head = calloc(1, sizeof(stat_head_t))) == NULL) {
rrd_set_error("allocating rrd.stat_head");
- rrd_free(&rrd);
+ free(rrd.stat_head);
return (-1);
}
/* live header */
if ((rrd.live_head = calloc(1, sizeof(live_head_t))) == NULL) {
rrd_set_error("allocating rrd.live_head");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
old_size + sizeof(ds_def_t))) ==
NULL) {
rrd_set_error("allocating rrd.ds_def");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
memset(&rrd.ds_def[rrd.stat_head->ds_cnt], 0, sizeof(ds_def_t));
rrd_set_error("invalid DS format");
}
if (rrd_test_error()) {
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
}
if (rrd_test_error()) {
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
rrd.stat_head->ds_cnt++;
old_size + sizeof(rra_def_t))) ==
NULL) {
rrd_set_error("allocating rrd.rra_def");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
memset(&rrd.rra_def[rrd.stat_head->rra_cnt], 0,
if (rrd_test_error()) {
/* all errors are unrecoverable */
free(argvcopy);
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
token = strtok_r(NULL, ":", &tokptr);
if (create_hw_contingent_rras(&rrd, period, hashed_name) ==
-1) {
rrd_set_error("creating contingent RRA");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
}
rrd.stat_head->rra_cnt++;
} else {
rrd_set_error("can't parse argument '%s'", argv[i]);
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
}
if (rrd.stat_head->rra_cnt < 1) {
rrd_set_error("you must define at least one Round Robin Archive");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
if (rrd.stat_head->ds_cnt < 1) {
rrd_set_error("you must define at least one Data Source");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
return rrd_create_fn(filename, &rrd);
if ((rrd_file = open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) {
rrd_set_error("creating '%s': %s", file_name, rrd_strerror(errno));
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
return (-1);
}
if ((rrd->pdp_prep = calloc(1, sizeof(pdp_prep_t))) == NULL) {
rrd_set_error("allocating pdp_prep");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
}
if ((rrd->cdp_prep = calloc(1, sizeof(cdp_prep_t))) == NULL) {
rrd_set_error("allocating cdp_prep");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
}
if ((rrd->rra_ptr = calloc(1, sizeof(rra_ptr_t))) == NULL) {
rrd_set_error("allocating rra_ptr");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
}
/* write the empty data area */
if ((unknown = (rrd_value_t *) malloc(512 * sizeof(rrd_value_t))) == NULL) {
rrd_set_error("allocating unknown");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
}
}
free(unknown);
fdatasync(rrd_file);
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
if (close(rrd_file) == -1) {
rrd_set_error("creating rrd: %s", rrd_strerror(errno));
return -1;
/* flush all we don't need out of the cache */
rrd_file_dn = rrd_open(file_name, &rrd_dn, RRD_READONLY);
rrd_dontneed(rrd_file_dn, &rrd_dn);
+ rrd_free(&rrd_dn);
rrd_close(rrd_file_dn);
return (0);
}