==145== Memcheck, a memory error detector ==145== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==145== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info ==145== Command: ./a.out ==145== ==145== Invalid write of size 4 ==145== at 0x401144: f (demo.c:6) ==145== by 0x401155: main (demo.c:11) ==145== Address 0x4a27068 is 0 bytes after a block of size 40 alloc'd ==145== at 0x484086F: malloc (vg_replace_malloc.c:380) ==145== by 0x401137: f (demo.c:5) ==145== by 0x401155: main (demo.c:11) ==145== ==145== ==145== HEAP SUMMARY: ==145== in use at exit: 40 bytes in 1 blocks ==145== total heap usage: 1 allocs, 0 frees, 40 bytes allocated ==145== ==145== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==145== at 0x484086F: malloc (vg_replace_malloc.c:380) ==145== by 0x401137: f (demo.c:5) ==145== by 0x401155: main (demo.c:11) ==145== ==145== LEAK SUMMARY: ==145== definitely lost: 40 bytes in 1 blocks ==145== indirectly lost: 0 bytes in 0 blocks ==145== possibly lost: 0 bytes in 0 blocks ==145== still reachable: 0 bytes in 0 blocks ==145== suppressed: 0 bytes in 0 blocks ==145== ==145== For lists of detected and suppressed errors, rerun with: -s ==145== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
==145== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==145== at 0x484086F: malloc (vg_replace_malloc.c:380) ==145== by 0x401137: f (demo.c:5) ==145== by 0x401155: main (demo.c:11)