$ valgrind ./a.out --track-origins=yes ==6833== Memcheck, a memory error detector ==6833== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==6833== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==6833== Command: ./a.out --track-origins=yes ==6833== Command line vocabulary flash cards v21 Opening file example.txt Reading line 1 # load_deck: commented line Reading line 2 Reading line 3 Reading line 4 # load_deck: empty line Reading line 5 Reading line 6 Reading line 7 Reading line 8 Reading line 9 Reading line 10 # load_deck: commented line Reading line 11 Reading line 12 Reading line 13 Reading line 14 Reading line 15 Reading line 16 Reading line 17 Reading line 18 Reading line 19 Reading line 20 Reading line 21 Reading line 22 Reading line 23 Reached End Of File Cleaning up ==6833== Use of uninitialised value of size 8 ==6833== at 0x401774: empty_all (quiz28.c:353) ==6833== by 0x4018F9: main (quiz28.c:380) ==6833== ==6833== Invalid read of size 4 ==6833== at 0x401774: empty_all (quiz28.c:353) ==6833== by 0x4018F9: main (quiz28.c:380) ==6833== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==6833== ==6833== ==6833== Process terminating with default action of signal 11 (SIGSEGV) ==6833== Access not within mapped region at address 0x0 ==6833== at 0x401774: empty_all (quiz28.c:353) ==6833== by 0x4018F9: main (quiz28.c:380) ==6833== If you believe this happened as a result of a stack ==6833== overflow in your program's main thread (unlikely but ==6833== possible), you can try to increase the size of the ==6833== main thread stack using the --main-stacksize= flag. ==6833== The main thread stack size used in this run was 8388608. ==6833== ==6833== HEAP SUMMARY: ==6833== in use at exit: 7,898 bytes in 62 blocks ==6833== total heap usage: 82 allocs, 20 frees, 10,370 bytes allocated ==6833== ==6833== LEAK SUMMARY: ==6833== definitely lost: 0 bytes in 0 blocks ==6833== indirectly lost: 0 bytes in 0 blocks ==6833== possibly lost: 0 bytes in 0 blocks ==6833== still reachable: 7,898 bytes in 62 blocks ==6833== suppressed: 0 bytes in 0 blocks ==6833== Rerun with --leak-check=full to see details of leaked memory ==6833== ==6833== For counts of detected and suppressed errors, rerun with: -v ==6833== Use --track-origins=yes to see where uninitialised values come from ==6833== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 4) Segmentation fault