usr@usr-VirtualBox:~/test$ valgrind --leak-check=yes ./test.out ==2910== Memcheck, a memory error detector ==2910== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==2910== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==2910== Command: ./test.out ==2910== ==2910== Invalid free() / delete / delete[] / realloc() ==2910== at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2910== by 0x1086C5: main (in /home/usr/test/test.out) ==2910== Address 0x522f090 is 0 bytes inside a block of size 4 free'd ==2910== at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2910== by 0x1086B9: main (in /home/usr/test/test.out) ==2910== Block was alloc'd at ==2910== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2910== by 0x1086A9: main (in /home/usr/test/test.out) ==2910== ==2910== ==2910== HEAP SUMMARY: ==2910== in use at exit: 4 bytes in 1 blocks ==2910== total heap usage: 2 allocs, 2 frees, 8 bytes allocated ==2910== ==2910== 4 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==2910== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2910== by 0x10869B: main (in /home/usr/test/test.out) ==2910== ==2910== LEAK SUMMARY: ==2910== definitely lost: 4 bytes in 1 blocks ==2910== indirectly lost: 0 bytes in 0 blocks ==2910== possibly lost: 0 bytes in 0 blocks ==2910== still reachable: 0 bytes in 0 blocks ==2910== suppressed: 0 bytes in 0 blocks ==2910== ==2910== For counts of detected and suppressed errors, rerun with: -v ==2910== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)