aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-10 21:11:06 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-10 21:11:06 +0100
commit7078145599b9d3b77b361de2797d704e9346fb5d (patch)
tree68d421feeb483fa2629eaebdda590e07975f9ce9
parenteeb9c4688415a369bae565e4595b070b6e94c601 (diff)
downloadlibmicrohttpd-7078145599b9d3b77b361de2797d704e9346fb5d.tar.gz
libmicrohttpd-7078145599b9d3b77b361de2797d704e9346fb5d.zip
proposed fix for #6116
-rw-r--r--src/microhttpd/daemon.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 77ac1f87..4f7c2108 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6404,22 +6404,18 @@ MHD_start_daemon_va (unsigned int flags,
6404 MHD_socket_close_chk_ (listen_fd); 6404 MHD_socket_close_chk_ (listen_fd);
6405 goto free_and_fail; 6405 goto free_and_fail;
6406 } 6406 }
6407 if (0 == daemon->worker_pool_size) 6407 if (! MHD_mutex_init_ (&daemon->cleanup_connection_mutex))
6408 { /* Initialise connection mutex only if this daemon will handle 6408 {
6409 * any connections by itself. */
6410 if (! MHD_mutex_init_ (&daemon->cleanup_connection_mutex))
6411 {
6412#ifdef HAVE_MESSAGES 6409#ifdef HAVE_MESSAGES
6413 MHD_DLOG (daemon, 6410 MHD_DLOG (daemon,
6414 _ ("MHD failed to initialize IP connection limit mutex\n")); 6411 _ ("MHD failed to initialize IP connection limit mutex\n"));
6415#endif 6412#endif
6416#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 6413#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
6417 MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); 6414 MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
6418#endif 6415#endif
6419 if (MHD_INVALID_SOCKET != listen_fd) 6416 if (MHD_INVALID_SOCKET != listen_fd)
6420 MHD_socket_close_chk_ (listen_fd); 6417 MHD_socket_close_chk_ (listen_fd);
6421 goto free_and_fail; 6418 goto free_and_fail;
6422 }
6423 } 6419 }
6424#endif 6420#endif
6425 6421
@@ -6435,8 +6431,7 @@ MHD_start_daemon_va (unsigned int flags,
6435 if (MHD_INVALID_SOCKET != listen_fd) 6431 if (MHD_INVALID_SOCKET != listen_fd)
6436 MHD_socket_close_chk_ (listen_fd); 6432 MHD_socket_close_chk_ (listen_fd);
6437#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 6433#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
6438 if (0 == daemon->worker_pool_size) 6434 MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
6439 MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
6440 MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); 6435 MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex);
6441#endif 6436#endif
6442 goto free_and_fail; 6437 goto free_and_fail;