From 9853ff6ce6ab49bd10614a6733cd234a164026d6 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Mon, 31 Jan 2011 13:35:18 +0100 Subject: [PATCH] Fix possible core-dump as seen in regression testing Thread 2 (Thread 1132489024 (LWP 21031)): lockmgr.c:939 Dereference jcr->db after release of jcr will lead to disaster. --- bacula/src/dird/msgchan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index e6cdc33e52..816df58bac 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -353,15 +353,15 @@ bool start_storage_daemon_message_thread(JCR *jcr) extern "C" void msg_thread_cleanup(void *arg) { JCR *jcr = (JCR *)arg; - db_end_transaction(jcr, jcr->db); /* terminate any open transaction */ + db_end_transaction(jcr, jcr->db); /* terminate any open transaction */ jcr->lock(); jcr->sd_msg_thread_done = true; jcr->SD_msg_chan = 0; jcr->unlock(); pthread_cond_broadcast(&jcr->term_wait); /* wakeup any waiting threads */ Dmsg2(100, "=== End msg_thread. JobId=%d usecnt=%d\n", jcr->JobId, jcr->use_count()); - free_jcr(jcr); /* release jcr */ - db_thread_cleanup(jcr->db); /* remove thread specific data */ + db_thread_cleanup(jcr->db); /* remove thread specific data */ + free_jcr(jcr); /* release jcr */ } /* -- 2.39.5