memory leak

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

memory leak

steffka
I'm playing around with libjack in C. I have the following Code:

#include <jack/jack.h>

int main (int argc, char *argv[])
{
  jack_client_t *client;
  client = jack_client_open ("test", JackNoStartServer, NULL, NULL);
  jack_client_close (client);
  return 0;
}

I compile it with:

gcc test.c `pkg-config --cflags --libs jack` -o test
and then run valgrind:

valgrind --leak-check=full --show-leak-kinds=all ./test
valgrinds output:

==14685== Memcheck, a memory error detector
==14685== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14685== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==14685== Command: ./test
==14685==
==14685==
==14685== HEAP SUMMARY:
==14685==     in use at exit: 9 bytes in 1 blocks
==14685==   total heap usage: 5 allocs, 4 frees, 1,315 bytes allocated    
==14685==
==14685== 9 bytes in 1 blocks are still reachable in loss record 1 of 1
==14685==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14685==    by 0x4E3E5AC: jack_client_open_aux (in /usr/lib/x86_64-linux-gnu/libjack.so.0.0.28)
==14685==    by 0x4E3EB11: jack_client_open (in /usr/lib/x86_64-linux-gnu/libjack.so.0.0.28)
==14685==    by 0x400719: main (in /home/steffka/cppProjects/test/test)
==14685==
==14685== LEAK SUMMARY:
==14685==    definitely lost: 0 bytes in 0 blocks
==14685==    indirectly lost: 0 bytes in 0 blocks
==14685==      possibly lost: 0 bytes in 0 blocks
==14685==    still reachable: 9 bytes in 1 blocks
==14685==         suppressed: 0 bytes in 0 blocks
==14685==
==14685== For counts of detected and suppressed errors, rerun with: -v
==14685== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

How can i free these 9 bytes ?

JackServer is not running