MemIo calls msync but FileIo does not
I revisited the commits bound to #1043, esp. r3630. I do no think that msync is necessary for MemIo. According to http://man7.org/linux/man-pages/man2/msync.2.html msync is only useful for memory mapped files which is not the case in MemIo. I would rather see it in FileIo where memory mapped files are used. Thus my questions in #1043-28 (28) and #1043-29 (29) are still not answered.
Updated by Andreas Huggel almost 6 years ago
Stumbled upon this because valgrind complains about msync() being called with uninitialized parameters.
After some reading, I agree with Thomas that msync() is not necessary for MemIo. I'd simply remove it. Also, according to this thread, it is not needed before munmap(), at least on POSIX systems.
Robin, I'm not making any changes since you plan to revisit this. If you're ok with my suggestion, you can assign this issue to me and I'll do it.
==4932== Syscall param msync(start) points to uninitialised byte(s) ==4932== at 0x5D8BD80: __msync_nocancel (syscall-template.S:81) ==4932== by 0x429972: Exiv2::MemIo::msync() (basicio.cpp:1297) ==4932== by 0x42921D: Exiv2::MemIo::~MemIo() (basicio.cpp:1177) ==4932== by 0x42929F: Exiv2::MemIo::~MemIo() (basicio.cpp:1181) ==4932== by 0x42E1D8: std::auto_ptr<Exiv2::BasicIo>::~auto_ptr() (in /usr/local/bin/exiv2) ==4932== by 0x4664D3: Exiv2::JpegBase::writeMetadata() (jpgimage.cpp:664) ==4932== by 0x41CCFD: Action::Modify::run(std::string const&) (actions.cpp:1259) ==4932== by 0x406D69: main (exiv2.cpp:171) ==4932== Address 0x6093212 is 34 bytes inside a block of size 40 alloc'd ==4932== at 0x4C2C7A7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==4932== by 0x42913B: Exiv2::MemIo::MemIo() (basicio.cpp:1165) ==4932== by 0x427190: Exiv2::FileIo::temporary() const (basicio.cpp:614) ==4932== by 0x466404: Exiv2::JpegBase::writeMetadata() (jpgimage.cpp:659) ==4932== by 0x41CCFD: Action::Modify::run(std::string const&) (actions.cpp:1259) ==4932== by 0x406D69: main (exiv2.cpp:171)