[cvetomir@localhost ex-17]$ ./utils/test-cases.sh
==11538== Memcheck, a memory error detector
==11538== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==11538== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==11538== Command: ./ex17 db.dat c 101 512
==11538==
==11538== Invalid write of size 8
==11538== at 0x400D79: Database_create (db_operations.c:155)
==11538== by 0x40113B: main (main.c:38)
==11538== Address 0x52193c0 is 0 bytes after a block of size 103,200 alloc'd
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AD0: Database_open (db_operations.c:98)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== Invalid write of size 8
==11538== at 0x400DB6: Database_create (db_operations.c:155)
==11538== by 0x40113B: main (main.c:38)
==11538== Address 0x52193c8[cvetomir@localhost ex-17]$ ./utils/test-cases.sh
==11538== Memcheck, a memory error detector
==11538== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==11538== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==11538== Command: ./ex17 db.dat c 101 512
==11538==
==11538== Invalid write of size 8
==11538== at 0x400D79: Database_create (db_operations.c:155)
==11538== by 0x40113B: main (main.c:38)
==11538== Address 0x52193c0 is 0 bytes after a block of size 103,200 alloc'd
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AD0: Database_open (db_operations.c:98)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== Invalid write of size 8
==11538== at 0x400DB6: Database_create (db_operations.c:155)
==11538== by 0x40113B: main (main.c:38)
==11538== Address 0x52193c8 is 8 bytes after a block of size 103,200 alloc'd
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AD0: Database_open (db_operations.c:98)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== Invalid read of size 8
==11538== at 0x4EB1930: fseek (fseek.c:35)
==11538== by 0x400C0E: Database_write (db_operations.c:133)
==11538== by 0x401147: main (main.c:39)
==11538== Address 0x8 is not stack'd, malloc'd or (recently) free'd
==11538==
==11538==
==11538== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==11538== Access not within mapped region at address 0x8
==11538== at 0x4EB1930: fseek (fseek.c:35)
==11538== by 0x400C0E: Database_write (db_operations.c:133)
==11538== by 0x401147: main (main.c:39)
==11538== If you believe this happened as a result of a stack
==11538== overflow in your program's main thread (unlikely but
==11538== possible), you can try to increase the size of the
==11538== main thread stack using the --main-stacksize= flag.
==11538== The main thread stack size used in this run was 8388608.
==11538==
==11538== HEAP SUMMARY:
==11538== in use at exit: 107,880 bytes in 5 blocks
==11538== total heap usage: 5 allocs, 0 frees, 107,880 bytes allocated
==11538==
==11538== 8 bytes in 1 blocks are still reachable in loss record 1 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400CA0: Database_create (db_operations.c:144)
==11538== by 0x40113B: main (main.c:38)
==11538==
==11538== 24 bytes in 1 blocks are still reachable in loss record 2 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AAA: Database_open (db_operations.c:95)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== 552 bytes in 1 blocks are still reachable in loss record 3 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x4EA904C: __fopen_internal (iofopen.c:69)
==11538== by 0x400B10: Database_open (db_operations.c:107)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== 4,096 bytes in 1 blocks are definitely lost in loss record 4 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x4EA84A1: _IO_file_doallocate (filedoalloc.c:101)
==11538== by 0x4EB7975: _IO_doallocbuf (genops.c:398)
==11538== by 0x4EB42E2: _IO_file_seekoff@@GLIBC_2.2.5 (fileops.c:1031)
==11538== by 0x4EB2003: rewind (rewind.c:35)
==11538== by 0x400CE7: Database_create (db_operations.c:148)
==11538== by 0x40113B: main (main.c:38)
==11538==
==11538== 103,200 bytes in 1 blocks are still reachable in loss record 5 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AD0: Database_open (db_operations.c:98)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== LEAK SUMMARY:
==11538== definitely lost: 4,096 bytes in 1 blocks
==11538== indirectly lost: 0 bytes in 0 blocks
==11538== possibly lost: 0 bytes in 0 blocks
==11538== still reachable: 103,784 bytes in 4 blocks
==11538== suppressed: 0 bytes in 0 blocks
==11538==
==11538== For counts of detected and suppressed errors, rerun with: -v
==11538== ERROR SUMMARY: 28 errors from 4 contexts (suppressed: 0 from 0)
./utils/test-cases.sh: line 9: 11538 Segmentation fault (core dumped) valgrind --leak-check=full --show-leak-kinds=all ./ex17 db.dat c 101 512
is 8 bytes after a block of size 103,200 alloc'd
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AD0: Database_open (db_operations.c:98)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== Invalid read of size 8
==11538== at 0x4EB1930: fseek (fseek.c:35)
==11538== by 0x400C0E: Database_write (db_operations.c:133)
==11538== by 0x401147: main (main.c:39)
==11538== Address 0x8 is not stack'd, malloc'd or (recently) free'd
==11538==
==11538==
==11538== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==11538== Access not within mapped region at address 0x8
==11538== at 0x4EB1930: fseek (fseek.c:35)
==11538== by 0x400C0E: Database_write (db_operations.c:133)
==11538== by 0x401147: main (main.c:39)
==11538== If you believe this happened as a result of a stack
==11538== overflow in your program's main thread (unlikely but
==11538== possible), you can try to increase the size of the
==11538== main thread stack using the --main-stacksize= flag.
==11538== The main thread stack size used in this run was 8388608.
==11538==
==11538== HEAP SUMMARY:
==11538== in use at exit: 107,880 bytes in 5 blocks
==11538== total heap usage: 5 allocs, 0 frees, 107,880 bytes allocated
==11538==
==11538== 8 bytes in 1 blocks are still reachable in loss record 1 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400CA0: Database_create (db_operations.c:144)
==11538== by 0x40113B: main (main.c:38)
==11538==
==11538== 24 bytes in 1 blocks are still reachable in loss record 2 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AAA: Database_open (db_operations.c:95)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== 552 bytes in 1 blocks are still reachable in loss record 3 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x4EA904C: __fopen_internal (iofopen.c:69)
==11538== by 0x400B10: Database_open (db_operations.c:107)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== 4,096 bytes in 1 blocks are definitely lost in loss record 4 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x4EA84A1: _IO_file_doallocate (filedoalloc.c:101)
==11538== by 0x4EB7975: _IO_doallocbuf (genops.c:398)
==11538== by 0x4EB42E2: _IO_file_seekoff@@GLIBC_2.2.5 (fileops.c:1031)
==11538== by 0x4EB2003: rewind (rewind.c:35)
==11538== by 0x400CE7: Database_create (db_operations.c:148)
==11538== by 0x40113B: main (main.c:38)
==11538==
==11538== 103,200 bytes in 1 blocks are still reachable in loss record 5 of 5
==11538== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11538== by 0x400AD0: Database_open (db_operations.c:98)
==11538== by 0x401084: main (main.c:18)
==11538==
==11538== LEAK SUMMARY:
==11538== definitely lost: 4,096 bytes in 1 blocks
==11538== indirectly lost: 0 bytes in 0 blocks
==11538== possibly lost: 0 bytes in 0 blocks
==11538== still reachable: 103,784 bytes in 4 blocks
==11538== suppressed: 0 bytes in 0 blocks
==11538==
==11538== For counts of detected and suppressed errors, rerun with: -v
==11538== ERROR SUMMARY: 28 errors from 4 contexts (suppressed: 0 from 0)
./utils/test-cases.sh: line 9: 11538 Segmentation fault (core dumped) valgrind --leak-check=full --show-leak-kinds=all ./ex17 db.dat c 101 512