mqtt plugin: Fix resource leak.
authorDenys Fedoryshchenko <denys@visp.net.lb>
Fri, 6 Jan 2017 01:36:16 +0000 (03:36 +0200)
committerFlorian Forster <octo@collectd.org>
Tue, 17 Jan 2017 14:37:10 +0000 (15:37 +0100)
Fixes: #2123

src/mqtt.c

index 95deb00..6b76af9 100644 (file)
@@ -448,6 +448,7 @@ static int publish(mqtt_client_conf_t *conf, char const *topic,
      * measure; we will try to reconnect the next time we have to publish a
      * message */
     conf->connected = 0;
+    mosquitto_disconnect(conf->mosq);
 
     pthread_mutex_unlock(&conf->lock);
     return (-1);