$ valgrind --leak-check=full ./test
==18871== Memcheck, a memory error detector
==18871== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==18871== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==18871== Command: ./test
==18871==
==18871==
==18871== HEAP SUMMARY:
==18871== in use at exit: 64 bytes in 1 blocks
==18871== total heap usage: 28 allocs, 27 frees, 16,838 bytes allocated
==18871==
==18871== 64 bytes in 1 blocks are definitely lost in loss record 1 of 1
==18871== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18871== by 0x4130DC: dns_ai_setent (in /home/sustrik/dsock/test)
==18871== by 0x4137A2: dns_ai_nextent (in /home/sustrik/dsock/test)
==18871== by 0x414D6B: main (in /home/sustrik/dsock/test)
==18871==
==18871== LEAK SUMMARY:
==18871== definitely lost: 64 bytes in 1 blocks
==18871== indirectly lost: 0 bytes in 0 blocks
==18871== possibly lost: 0 bytes in 0 blocks
==18871== still reachable: 0 bytes in 0 blocks
==18871== suppressed: 0 bytes in 0 blocks
==18871==
==18871== For counts of detected and suppressed errors, rerun with: -v
==18871== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Test program:
Valgrind output: