From 8b72b0b9407d65146cf8b6ef55de1131c701fe10 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Thu, 14 Sep 2006 20:40:56 +0000 Subject: [PATCH] Fix possible semaphore leak. --- src/sbbs3/websrvr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c index d0296e0240..a4bb695730 100644 --- a/src/sbbs3/websrvr.c +++ b/src/sbbs3/websrvr.c @@ -4355,6 +4355,7 @@ void http_session_thread(void* arg) return; } + /* Destroyed in this block (before all returns) */ sem_init(&session.output_thread_terminated,0,0); _beginthread(http_output_thread, 0, &session); @@ -4381,6 +4382,7 @@ void http_session_thread(void* arg) if(trashcan(&scfg,host_name,"host")) { close_socket(&session.socket); sem_wait(&session.output_thread_terminated); + sem_destroy(&session.output_thread_terminated); RingBufDispose(&session.outbuf); pthread_mutex_destroy(&session.outbuf_write); lprintf(LOG_NOTICE,"%04d !CLIENT BLOCKED in host.can: %s", session.socket, host_name); @@ -4394,6 +4396,7 @@ void http_session_thread(void* arg) if(trashcan(&scfg,session.host_ip,"ip")) { close_socket(&session.socket); sem_wait(&session.output_thread_terminated); + sem_destroy(&session.output_thread_terminated); RingBufDispose(&session.outbuf); pthread_mutex_destroy(&session.outbuf_write); lprintf(LOG_NOTICE,"%04d !CLIENT BLOCKED in ip.can: %s", session.socket, session.host_ip); -- GitLab