From d5dead4ea0dd61fd054eafc08241580c64881a69 Mon Sep 17 00:00:00 2001 From: Tomas Heinrich Date: Mon, 9 Dec 2013 17:59:46 +0100 Subject: [PATCH] bugfix: prevent a segfault during imtcp's shutdown If imtcp is loaded and no listeners are configured (which is uncommon), rsyslog crashes during shutdown. The cause is that startWorkerPool() is called unconditionally during modExit() even if there are no listerners. Correcting this triggers a memleak of the wrkrMut mutex which shouldn't have been destroyed in startWorkerPool() in the first place. --- tcpsrv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tcpsrv.c b/tcpsrv.c index c64fa3e82..9e01e13ba 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -1395,7 +1395,10 @@ stopWorkerPool(void) BEGINmodExit CODESTARTmodExit - stopWorkerPool(); + if(bWrkrRunning) { + stopWorkerPool(); + bWrkrRunning = 0; + } /* de-init in reverse order! */ tcpsrvClassExit(); tcps_sessClassExit();