# HG changeset patch # User Sam Lantinga # Date 1018559324 0 # Node ID b9f1ce709960e91ec7425dd3cffceb20753cee5d # Parent eed579d059ef07bd09eec5f2cbf3e97bc4755dc8 Fixed a minor memory leak in the SDL thread subsystem diff -r eed579d059ef -r b9f1ce709960 src/thread/SDL_thread.c --- a/src/thread/SDL_thread.c Thu Apr 11 18:22:05 2002 +0000 +++ b/src/thread/SDL_thread.c Thu Apr 11 21:08:44 2002 +0000 @@ -146,10 +146,15 @@ } } if ( i < SDL_numthreads ) { - --SDL_numthreads; - while ( i < SDL_numthreads ) { - SDL_Threads[i] = SDL_Threads[i+1]; - ++i; + if ( --SDL_numthreads > 0 ) { + while ( i < SDL_numthreads ) { + SDL_Threads[i] = SDL_Threads[i+1]; + ++i; + } + } else { + SDL_maxthreads = 0; + free(SDL_Threads); + SDL_Threads = NULL; } #ifdef DEBUG_THREADS printf("Deleting thread (%d left - %d max)\n",