nanoleak2.stderr.exp nanoleak2.vgtest \
new_nothrow.stderr.exp new_nothrow.vgtest \
new_override.stderr.exp new_override.stdout.exp new_override.vgtest \
+ noisy_child.vgtest noisy_child.stderr.exp noisy_child.stdout.exp \
null_socket.stderr.exp null_socket.vgtest \
overlap.stderr.exp overlap.stdout.exp overlap.vgtest \
oset_test.stderr.exp oset_test.stdout.exp oset_test.vgtest \
match-overrun \
memalign_test memalign2 memcmptest mempool mmaptest \
nanoleak nanoleak2 new_nothrow \
+ noisy_child \
null_socket oset_test overlap \
partiallydefinedeq \
partial_load pdb-realloc pdb-realloc2 \
--- /dev/null
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <assert.h>
+
+void do_child_badness ( char* p )
+{
+ /* Free it a second time */
+ free(p);
+}
+
+void do_parent_badness ( char* p )
+{
+ /* Do a write off the end */
+ p[10] = 42;
+}
+
+
+int main ( void )
+{
+ pid_t child;
+ char* p = malloc(10); assert(p);
+ free(p);
+
+ /* parent does something bad */
+ p[5] = 22;
+
+ child = fork();
+ assert(child != -1); /* assert fork did not fail */
+
+ if (child == 0) {
+ /* I am the child */
+ do_child_badness(p);
+ } else {
+ /* I am the parent */
+ do_parent_badness(p);
+ }
+
+ return 0;
+
+}
--- /dev/null
+
+Invalid write of size 1
+ at 0x........: main (noisy_child.c:27)
+ Address 0x........ is 5 bytes inside a block of size 10 free'd
+ at 0x........: free (vg_replace_malloc.c:...)
+ by 0x........: main (noisy_child.c:24)
+
+Invalid write of size 1
+ at 0x........: do_parent_badness (noisy_child.c:16)
+ by 0x........: main (noisy_child.c:37)
+ Address 0x........ is 0 bytes after a block of size 10 free'd
+ at 0x........: free (vg_replace_malloc.c:...)
+ by 0x........: main (noisy_child.c:24)
+
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 1 allocs, 1 frees, 10 bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
--- /dev/null
+prog: noisy_child
+vgopts: --child-silent-after-fork=yes