Valgrind shows SDL_CreateThread memory leak ? (yes, with SDL_WaitThread)

Hello,

Using SDL 1.2.7 on Linux 2.6.12 with glibc 2.3.5-6, Valgrind shows a
potential memory leak when analyzing the code fragment below. Is this a
known issue, or am I doing something wrong ?

Regards=======================================================================

/*

  • gcc -O0 -g test.c -I/usr/include/SDL -lSDL
  • valgrind --leak-check=full ./a.out
    */

#include <SDL_net.h>
#include <SDL_thread.h>

int foo_connect_thread(void *thread_data)
{
SDL_Delay(1000);
return 0;
}

int main(int argc, char **argv)
{
SDL_Thread *thread;
int status;

    SDL_Init(0);
    
    thread = SDL_CreateThread(foo_connect_thread, NULL);
    SDL_WaitThread(thread, &status);
    
    SDL_Quit();
    
    return 0;

}

=======================================================================

This is the part valgrind complains about :

==20471== 68 bytes in 1 blocks are possibly lost in loss record 5 of 7
==20471== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==20471== by 0x1B8F16A7: (within /lib/ld-2.3.5.so)
==20471== by 0x1B8F197B: _dl_allocate_tls (in /lib/ld-2.3.5.so)
==20471== by 0x411804F0: pthread_create@@GLIBC_2.1 (in/lib/tls/libpthread-2.3.5.so)
==20471== by 0x1B979916: SDL_SYS_CreateThread (in /usr/lib/libSDL-1.2.so.0.7.1)
==20471== by 0x1B97967F: SDL_CreateThread (in /usr/lib/libSDL-1.2.so.0.7.1)
==20471== by 0x804859C: main (test.c:23)

This is the part valgrind complains about :

==20471== 68 bytes in 1 blocks are possibly lost in loss record 5 of 7
==20471== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==20471== by 0x1B8F16A7: (within /lib/ld-2.3.5.so)
==20471== by 0x1B8F197B: _dl_allocate_tls (in /lib/ld-2.3.5.so)
==20471== by 0x411804F0: pthread_create@@GLIBC_2.1 (in/lib/tls/libpthread-2.3.5.so)
==20471== by 0x1B979916: SDL_SYS_CreateThread (in /usr/lib/libSDL-1.2.so.0.7.1)
==20471== by 0x1B97967F: SDL_CreateThread (in /usr/lib/libSDL-1.2.so.0.7.1)
==20471== by 0x804859C: main (test.c:23)

I’m on a pre-tls version of glibc, so I get a different valgrind
result…however, here’s a pthread-only version of that program, and I
bet it gets the same valgrind warnings as the SDL one, and thus is a
valgrind issue in glibc and not SDL.

–ryan.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.c
Type: text/x-csrc
Size: 848 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051011/b14c6725/attachment.c