diff --git a/ChangeLog.txt b/ChangeLog.txt index cff2a285..739d16a1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -8,6 +8,10 @@ Broker: - Various fixes around inflight quota management. Closes #2306. - Fix problem parsing config files with Windows line endings. Closes #2297. +Client library: +- Initialise sockpairR/W to invalid in `mosquitto_reinitialise()` to avoid + closing invalid sockets in `mosquitto_destroy()` on error. Closes #2326. + 2.0.12 - 2021-08-31 =================== diff --git a/lib/mosquitto.c b/lib/mosquitto.c index 8c0dbeeb..cd8fc00a 100644 --- a/lib/mosquitto.c +++ b/lib/mosquitto.c @@ -155,6 +155,8 @@ int mosquitto_reinitialise(struct mosquitto *mosq, const char *id, bool clean_st } mosq->protocol = mosq_p_mqtt311; mosq->sock = INVALID_SOCKET; + mosq->sockpairR = INVALID_SOCKET; + mosq->sockpairW = INVALID_SOCKET; mosq->keepalive = 60; mosq->clean_start = clean_start; if(id){