mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-07 15:34:04 +00:00
Add mosquitto_loop_stop before mosquitto_destroy in close()
The background network thread started by mosquitto_loop_start() was not being stopped before mosquitto_destroy(), which can cause a use-after-free if the thread is still running when the mosquitto structure is freed.
This commit is contained in:
parent
8efcac05e6
commit
469306ff1f
1 changed files with 1 additions and 0 deletions
|
|
@ -147,6 +147,7 @@ void CMQTTConnection::close()
|
|||
{
|
||||
if (m_mosq != nullptr) {
|
||||
::mosquitto_disconnect(m_mosq);
|
||||
::mosquitto_loop_stop(m_mosq, true);
|
||||
::mosquitto_destroy(m_mosq);
|
||||
m_mosq = nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue