mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-03-10 23:33:56 +01: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
|
|
@ -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…
Reference in a new issue