Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 6d4b6215 authored by rswindell's avatar rswindell

Resolve crash when sbbs->init() fails and the sbbs_t destructor tries to

destroy the ssh_mutex (which was not initialized).
parent 599fc42c
......@@ -2965,6 +2965,7 @@ sbbs_t::sbbs_t(ushort node_num, SOCKADDR_IN addr, const char* name, SOCKET sd,
#ifdef USE_CRYPTLIB
ssh_mode=false;
ssh_mutex_created=false;
passthru_input_thread_running = false;
passthru_output_thread_running = false;
#endif
......@@ -3353,7 +3354,10 @@ bool sbbs_t::init()
}
}
#ifdef USE_CRYPTLIB
pthread_mutex_init(&ssh_mutex,NULL);
ssh_mutex_created = true;
#endif
pthread_mutex_init(&input_thread_mutex,NULL);
reset_logon_vars();
......@@ -3481,8 +3485,10 @@ sbbs_t::~sbbs_t()
FREE_AND_NULL(batdn_cdt);
FREE_AND_NULL(batdn_alt);
while(pthread_mutex_destroy(&ssh_mutex)==EBUSY)
#ifdef USE_CRYPTLIB
while(ssh_mutex_created && pthread_mutex_destroy(&ssh_mutex)==EBUSY)
mswait(1);
#endif
while(pthread_mutex_destroy(&input_thread_mutex)==EBUSY)
mswait(1);
......
......@@ -336,6 +336,7 @@ public:
pthread_mutex_t input_thread_mutex;
bool input_thread_mutex_locked; // by someone other than the input_thread
pthread_mutex_t ssh_mutex;
bool ssh_mutex_created;
int outcom(uchar ch); // send character
int incom(unsigned long timeout=0); // receive character
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment