==22844== Memcheck, a memory error detector ==22844== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==22844== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==22844== Command: ./test01 ==22844== ==22844== Invalid write of size 4 ==22844== at 0x10889D: f (test01.c:85) ==22844== by 0x1087B0: main (test01.c:38) ==22844== Address 0x522e0a8 is 0 bytes after a block of size 40 alloc'd ==22844== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==22844== by 0x1087F5: f (test01.c:75) ==22844== by 0x1087B0: main (test01.c:38) ==22844== ==22844== Invalid read of size 4 ==22844== at 0x1088B3: f (test01.c:86) ==22844== by 0x1087B0: main (test01.c:38) ==22844== Address 0x522e0a8 is 0 bytes after a block of size 40 alloc'd ==22844== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==22844== by 0x1087F5: f (test01.c:75) ==22844== by 0x1087B0: main (test01.c:38) ==22844== TEST01: C version A sample code for analysis by VALGRIND. 0 1 1 1 2 2 3 3 4 5 5 8 6 13 7 21 8 34 9 55 10 89 TEST01 Normal end of execution. ==22844== ==22844== HEAP SUMMARY: ==22844== in use at exit: 0 bytes in 0 blocks ==22844== total heap usage: 2 allocs, 2 frees, 4,136 bytes allocated ==22844== ==22844== All heap blocks were freed -- no leaks are possible ==22844== ==22844== For counts of detected and suppressed errors, rerun with: -v ==22844== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)