arjunhm / c-hash-tables

0 stars 0 forks source link

Valgrind 2 #2

Closed arjunhm closed 1 month ago

arjunhm commented 2 months ago

Commit: 2cc0f81eb096134baaf1c810a8299de61c724ae4

==14414== Invalid read of size 1
==14414==    at 0x483EF54: strlen (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==14414==    by 0x1094D0: hash (lp_hash.c:70)
==14414==    by 0x10968E: insert (lp_hash.c:116)
==14414==    by 0x10978F: main (lp_hash.c:143)
==14414==  Address 0x4a49141 is 0 bytes after a block of size 1 alloc'd
==14414==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==14414==    by 0x1092EB: generate_word (lp_hash.c:22)
==14414==    by 0x10945C: generate_item (lp_hash.c:63)
==14414==    by 0x109778: main (lp_hash.c:142)
==14414==
==14414== Conditional jump or move depends on uninitialised value(s)
==14414==    at 0x1095A6: linear_probe (lp_hash.c:78)
==14414==    by 0x1096B5: insert (lp_hash.c:119)
==14414==    by 0x10978F: main (lp_hash.c:143)
==14414==
----
resizing
-----
==14414== Use of uninitialised value of size 8
==14414==    at 0x483EF46: strlen (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==14414==    by 0x1094D0: hash (lp_hash.c:70)
==14414==    by 0x10962E: resize (lp_hash.c:107)
==14414==    by 0x1096DB: insert (lp_hash.c:122)
==14414==    by 0x10978F: main (lp_hash.c:143)
==14414==
==14414== Invalid read of size 1
==14414==    at 0x483EF46: strlen (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==14414==    by 0x1094D0: hash (lp_hash.c:70)
==14414==    by 0x10962E: resize (lp_hash.c:107)
==14414==    by 0x1096DB: insert (lp_hash.c:122)
==14414==    by 0x10978F: main (lp_hash.c:143)
==14414==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==14414==
==14414==
==14414== Process terminating with default action of signal 11 (SIGSEGV)
==14414==  Access not within mapped region at address 0x0
==14414==    at 0x483EF46: strlen (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==14414==    by 0x1094D0: hash (lp_hash.c:70)
==14414==    by 0x10962E: resize (lp_hash.c:107)
==14414==    by 0x1096DB: insert (lp_hash.c:122)
==14414==    by 0x10978F: main (lp_hash.c:143)
==14414==  If you believe this happened as a result of a stack
==14414==  overflow in your program's main thread (unlikely but
==14414==  possible), you can try to increase the size of the
==14414==  main thread stack using the --main-stacksize= flag.
==14414==  The main thread stack size used in this run was 8388608.
==14414==
==14414== HEAP SUMMARY:
==14414==     in use at exit: 129 bytes in 5 blocks
==14414==   total heap usage: 6 allocs, 1 frees, 1,153 bytes allocated
==14414==
==14414== LEAK SUMMARY:
==14414==    definitely lost: 0 bytes in 0 blocks
==14414==    indirectly lost: 0 bytes in 0 blocks
==14414==      possibly lost: 0 bytes in 0 blocks
==14414==    still reachable: 129 bytes in 5 blocks
==14414==         suppressed: 0 bytes in 0 blocks
==14414== Reachable blocks (those to which a pointer was found) are not shown.
==14414== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==14414==
==14414== Use --track-origins=yes to see where uninitialised values come from
==14414== For lists of detected and suppressed errors, rerun with: -s
==14414== ERROR SUMMARY: 5 errors from 4 contexts (suppressed: 0 from 0)
make: *** [makefile:21: val_lp] Segmentation fault