i have the following program that simulate a double free : #include int main() { int *t = new int(); delete (t); delete (t); } I set MALLOC_CHECK_ to 1 for debugging, when i try to redirct the output of the malloc debugging thing, one of the two lines doesn't get redirected. Looking at strace output, it seems that the process opening stdout twice : open("/dev/tty", O_RDWR|O_NONBLOCK|O_NOCTTY) = 4 writev(4, [{"malloc: using debugging hooks", 29}, {"\n", 1}], 2malloc: using debugging ) = 30 and open("/dev/tty", O_RDWR|O_NONBLOCK|O_NOCTTY) = 5 writev(5, [{"*** glibc detected *** ", 23}, {"free(): invalid pointer", 23}, {": 0x", 4}, {"08b23008", 8}, {" ***\n", 5}], 5*** glibc detected *** free(): invalid pointer: 0x08b23008 *** is there a way to workaround this issue and have both lines redirected ?