Richard said:
(e-mail address removed) wrote...
Valid for cup I expect, and should be of interest here on clc.
Before somebody says "fix your code," the pointer is coming to
me from a library. Valgrind is claiming it's a non-null pointer
to a block that hasn't been allocated.
You may want to look at my nmalloc for DJGPP. It is close to
standard C, but depends on various things (including pointer
arithmetic and sbrk) and the variadic macros are built around the
gcc (non-standard) technique. Those macros are only needed for
debuggery, but the variadic nature makes it impossible to just
define them out, thus you need gcc.
The point of this is that nmalloc has internal checks for
validity. Some of them are turned off by "#define SAVEMEMORY =
1". I originally had this enabled, which installed guard values
above and below the actual memory assignments, and with it
restored it should be possible to create an "int
_nmalloc_validptr(void *);" to provide close assurance of
validity, by checking that the block is assigned, with valid
forward and backwards pointers, and that the guards have not been
mangled.
If your existing code can be compiled under DJGPP you could try
most of this out with no changes. See the malldbg module in
nmalloc.
<
http://cbfalconer.home.att.net/download/nmalloc.zip>