summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2983137)
raw | patch | inline | side by side (parent: 2983137)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 31 May 2007 18:47:13 +0000 (18:47 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 31 May 2007 18:47:13 +0000 (18:47 +0000) |
- plug tiny mem-leak in error path of rrd_close where freeing the
rrd_file was forgotten.
- improve two error messages
- use CHECK_MADVISE_OVERLAPS per default
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1095 a5681a0c-68f1-0310-ab6d-d61299d08faa
rrd_file was forgotten.
- improve two error messages
- use CHECK_MADVISE_OVERLAPS per default
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1095 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_open.c | patch | blob | history |
diff --git a/src/rrd_open.c b/src/rrd_open.c
index 92369fd01c094bb560e77f6ad7d64f388059a04b..525fa29738f64a804896f93e80eda1aeafc992ae 100644 (file)
--- a/src/rrd_open.c
+++ b/src/rrd_open.c
//#define ONE_PAGE 1
/* Avoid calling madvise on areas that were already hinted. May be benefical if
* your syscalls are very slow */
-//#define CHECK_MADVISE_OVERLAPS 1
+#define CHECK_MADVISE_OVERLAPS 1
#ifdef HAVE_MMAP
#define __rrd_read(dst, dst_t, cnt) \
if ((rrd_file->fd = open(file_name, flags, mode)) < 0) {
rrd_set_error("opening '%s': %s", file_name, rrd_strerror(errno));
- return NULL;
+ goto out_free;
}
/* Better try to avoid seeks as much as possible. stat may be heavy but
/* lets see if the first read worked */
if (data == MAP_FAILED) {
- rrd_set_error("error mmaping file '%s': %s", file_name,
+ rrd_set_error("mmaping file '%s': %s", file_name,
rrd_strerror(errno));
goto out_close;
}
}
if (rrd->stat_head->float_cookie != FLOAT_COOKIE) {
- rrd_set_error("This RRD was created on other architecture");
+ rrd_set_error("This RRD was created on another architecture");
goto out_nullify_head;
}
rrd->stat_head = NULL;
out_close:
close(rrd_file->fd);
+ out_free:
+ free(rrd_file);
return NULL;
}