==1277== Memcheck, a memory error detector ==1277== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==1277== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==1277== Command: ./bug_bad_memory_access ==1277== Parent PID: 1666 ==1277== ==1277== Invalid write of size 4 ==1277== at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9) ==1277== by 0x400532: main (bug_bad_memory_access.c:14) ==1277== Address 0x4252352 is not stack'd, malloc'd or (recently) free'd ==1277== ==1277== ==1277== Process terminating with default action of signal 11 (SIGSEGV) ==1277== Access not within mapped region at address 0x4252352 ==1277== at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9) ==1277== by 0x400532: main (bug_bad_memory_access.c:14) ==1277== If you believe this happened as a result of a stack ==1277== overflow in your program's main thread (unlikely but ==1277== possible), you can try to increase the size of the ==1277== main thread stack using the --main-stacksize= flag. ==1277== The main thread stack size used in this run was 8388608. ==1277== ==1277== HEAP SUMMARY: ==1277== in use at exit: 0 bytes in 0 blocks ==1277== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==1277== ==1277== All heap blocks were freed -- no leaks are possible ==1277== ==1277== For counts of detected and suppressed errors, rerun with: -v ==1277== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)