From 71c707da4e5405c986399c3f4505fa0a554548ba Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 5 Aug 2019 12:47:15 +0200 Subject: [SERVER] Add sanity check to threadpool_run for NULL routine --- src/server/threadpool.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/server/threadpool.c') diff --git a/src/server/threadpool.c b/src/server/threadpool.c index c01ae7a..340a98d 100644 --- a/src/server/threadpool.c +++ b/src/server/threadpool.c @@ -50,6 +50,10 @@ void threadpool_close() bool threadpool_run(void *(*startRoutine)(void *), void *arg) { + if ( startRoutine == NULL ) { + logadd( LOG_ERROR, "Trying to queue work for thread pool with NULL startRoutine" ); + return false; // Or bail out!? + } pthread_spin_lock( &poolLock ); entry_t *entry = pool; if ( entry != NULL ) { -- cgit v1.2.3-55-g7522