From: Marco van Wieringen Date: Mon, 31 Jan 2011 12:35:18 +0000 (+0100) Subject: Fix possible core-dump as seen in regression testing X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9853ff6ce6ab49bd10614a6733cd234a164026d6;p=bacula%2Fbacula 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. --- 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 */ } /*