comparison src/thread/SDL_thread.c @ 340:b9f1ce709960

Fixed a minor memory leak in the SDL thread subsystem
author Sam Lantinga <slouken@libsdl.org>
date Thu, 11 Apr 2002 21:08:44 +0000
parents 1d74ddc90cb2
children 283d348cb624
comparison
equal deleted inserted replaced
339:eed579d059ef 340:b9f1ce709960
144 if ( thread == SDL_Threads[i] ) { 144 if ( thread == SDL_Threads[i] ) {
145 break; 145 break;
146 } 146 }
147 } 147 }
148 if ( i < SDL_numthreads ) { 148 if ( i < SDL_numthreads ) {
149 --SDL_numthreads; 149 if ( --SDL_numthreads > 0 ) {
150 while ( i < SDL_numthreads ) { 150 while ( i < SDL_numthreads ) {
151 SDL_Threads[i] = SDL_Threads[i+1]; 151 SDL_Threads[i] = SDL_Threads[i+1];
152 ++i; 152 ++i;
153 }
154 } else {
155 SDL_maxthreads = 0;
156 free(SDL_Threads);
157 SDL_Threads = NULL;
153 } 158 }
154 #ifdef DEBUG_THREADS 159 #ifdef DEBUG_THREADS
155 printf("Deleting thread (%d left - %d max)\n", 160 printf("Deleting thread (%d left - %d max)\n",
156 SDL_numthreads, SDL_maxthreads); 161 SDL_numthreads, SDL_maxthreads);
157 #endif 162 #endif