[ create a new paste ] login | about

Link: http://codepad.org/AODPuR4E    [ raw code | fork ]

C, pasted on Dec 17:
amiha@geohero:~$ gcc -g -Wall -o test test.c
amiha@geohero:~$ valgrind --leak-check=full ./test
==26624== Memcheck, a memory error detector
==26624== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==26624== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==26624== Command: ./test
==26624==
test00() : succeed
test0() : succeed
test1() : succeed
test2() : succeed
test3() : succeed
test4() : succeed
test5() : succeed
test6() : succeed
test7() : succeed
test8() : succeed
test9() : succeed
test10() : succeed
test11() : succeed
test12() : succeed
test13() : succeed
test14() : succeed
test15() : succeed
test16() : succeed
test17() : succeed
test18() : succeed
test19() : succeed
test20() : succeed
test21() : succeed
test22() : succeed
test23() : succeed
test24() : succeed
==26624== Invalid read of size 1
==26624==    at 0x4C2D812: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26624==    by 0x4007BB: str_len (test.c:84)
==26624==    by 0x400A11: str_cat (test.c:151)
==26624==    by 0x401A8E: test25 (test.c:524)
==26624==    by 0x402115: main (test.c:579)
==26624==  Address 0x51fe2e0 is 0 bytes inside a block of size 6 free'd
==26624==    at 0x4C2C6AE: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26624==    by 0x4008CC: _str_alloc_and_move (test.c:107)
==26624==    by 0x400931: _str_cpy (test.c:121)
==26624==    by 0x400975: str_cpy (test.c:127)
==26624==    by 0x401A83: test25 (test.c:524)
==26624==    by 0x402115: main (test.c:579)
==26624==
==26624== Invalid read of size 1
==26624==    at 0x4C2D824: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26624==    by 0x4007BB: str_len (test.c:84)
==26624==    by 0x400A11: str_cat (test.c:151)
==26624==    by 0x401A8E: test25 (test.c:524)
==26624==    by 0x402115: main (test.c:579)
==26624==  Address 0x51fe2e1 is 1 bytes inside a block of size 6 free'd
==26624==    at 0x4C2C6AE: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26624==    by 0x4008CC: _str_alloc_and_move (test.c:107)
==26624==    by 0x400931: _str_cpy (test.c:121)
==26624==    by 0x400975: str_cpy (test.c:127)
==26624==    by 0x401A83: test25 (test.c:524)
==26624==    by 0x402115: main (test.c:579)
==26624==
==26624== Invalid read of size 1
==26624==    at 0x4C2E864: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26624==    by 0x40087A: _str_alloc_and_move (test.c:107)
==26624==    by 0x4009EC: _str_cat (test.c:145)
==26624==    by 0x400A36: str_cat (test.c:151)
==26624==    by 0x401A8E: test25 (test.c:524)
==26624==    by 0x402115: main (test.c:579)
==26624==  Address 0x51fe2e5 is 5 bytes inside a block of size 6 free'd
==26624==    at 0x4C2C6AE: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26624==    by 0x4008CC: _str_alloc_and_move (test.c:107)
==26624==    by 0x400931: _str_cpy (test.c:121)
==26624==    by 0x400975: str_cpy (test.c:127)
==26624==    by 0x401A83: test25 (test.c:524)
==26624==    by 0x402115: main (test.c:579)
==26624==
test25() : failed
test26() : succeed
==26624==
==26624== HEAP SUMMARY:
==26624==     in use at exit: 0 bytes in 0 blocks
==26624==   total heap usage: 84 allocs, 84 frees, 3,158 bytes allocated
==26624==
==26624== All heap blocks were freed -- no leaks are possible
==26624==
==26624== For counts of detected and suppressed errors, rerun with: -v
==26624== ERROR SUMMARY: 12 errors from 3 contexts (suppressed: 2 from 2)


Create a new paste based on this one


Comments: