On Wed, Oct 22, 2014 at 5:47 AM, Cyrille Artho <c.ar...@aist.go.jp> wrote: > In my experience, false positives regarding uninitialized memory are > extremely rare. So it's most likely a real problem. Maybe the code refers to > stack-allocated memory or heap memory that was used just before, so the data > is still "in the right place" under normal cases? This could be the reason > why no crash has been observed with this code so far.
this is about heap-allocated memory that was freed. I would expect a segfault there, but I read that the free function sometimes avoid returning memory to the pool for a faster subsequent malloc (i.e. an optimization of the library). > Normally, reading data that is considered "uninitialized" by valgrind could > also read data that has recently been freed; AFAIK the error message is the > same. However, such code tends to work by coincidence rather than by design. The valgrind complain is indeed about reading freed memory. It is also my experience that false positives in valgrind are rare... A/