From: Max Khon Date: Wed, 25 Feb 2015 09:35:39 +0000 (+0600) Subject: Don't zero-out rrd->__mmap_start and rrd->__mmap_size. X-Git-Tag: v1.5.0~10^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4eb6a0abff31d4c54a987dbe14acbdf1423a72b0;p=thirdparty%2Frrdtool-1.x.git Don't zero-out rrd->__mmap_start and rrd->__mmap_size. Otherwise free_rrd_ptr_if_not_mmapped() will try to free non-malloc'ed memory. The error from OS X malloc debugger is: rrdtool(34216,0x7fff7bebd300) malloc: *** error for object 0x104a09d80: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6 --- diff --git a/src/rrd_open.c b/src/rrd_open.c index 614cc3c6..b4e151e2 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -472,8 +472,6 @@ read_check: #ifdef HAVE_MMAP if (data != MAP_FAILED) munmap(data, rrd_file->file_len); - rrd->__mmap_start = NULL; - rrd->__mmap_size = 0; #endif close(rrd_simple_file->fd);