1 /* For a long time (from Valgrind 1.0 to 1.9.6, AFAICT) when realloc() was
2 called and made a block smaller, or didn't change its size, the
3 ExeContext of the block was not updated; therefore any errors that
4 referred to it would state that it was allocated not by the realloc(),
5 but by the previous malloc() or whatever. While this is true in one
6 sense, it is misleading and not what you'd expect. This test
7 demonstrates this -- 'x' and 'y' are unchanged and shrunk, and their
8 ExeContexts should be updated upon their realloc(). I hope that's clear.
19 x
= realloc(x
, 5); // same size
20 y
= realloc(y
, 5); // make smaller
21 z
= realloc(z
, 5); // make bigger
23 a
= (x
[5] == 0xdeadbeef ? 1 : 0);
24 b
= (y
[5] == 0xdeadbeef ? 1 : 0);
25 c
= (z
[5] == 0xdeadbeef ? 1 : 0);