Detecting Memory Leaks II

commandline session

$gcc -g -ansi -pedantic -W -Wall algorithm.c
algorithm.c: In function ‘main’:
algorithm.c:47:5: warning: unused variable ‘value’ [-Wunused-variable]
algorithm.c:36:7: warning: unused variable ‘p’ [-Wunused-variable]
algorithm.c:35:5: warning: unused variable ‘i’ [-Wunused-variable]
algorithm.c:34:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
algorithm.c:34:26: warning: unused parameter ‘argv’ [-Wunused-parameter]
$valgrind --tool=memcheck --leak-check=full ./a.out
==23555== Memcheck, a memory error detector
==23555== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==23555== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==23555== Command: ./a.out
found in: htop-0.9
found in: .
==23555== HEAP SUMMARY:
==23555==     in use at exit: 0 bytes in 0 blocks
==23555==   total heap usage: 74 allocs, 74 frees, 45,235 bytes allocated
==23555== All heap blocks were freed -- no leaks are possible
==23555== For counts of detected and suppressed errors, rerun with: -v
==23555== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)