From 42fd01547dd8467a4c65e7fc37784df968c961f2 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Mon, 7 Aug 2017 20:43:25 +0200 Subject: [PATCH] Fix bug #51681: mqtt: cannot free client Add free function --- src/apps/mqtt/mqtt.c | 10 ++++++++++ src/include/lwip/apps/mqtt.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/apps/mqtt/mqtt.c b/src/apps/mqtt/mqtt.c index 1adcab0b..de6327d4 100644 --- a/src/apps/mqtt/mqtt.c +++ b/src/apps/mqtt/mqtt.c @@ -1214,6 +1214,16 @@ mqtt_client_new(void) return (mqtt_client_t *)mem_calloc(1, sizeof(mqtt_client_t)); } +/** + * @ingroup mqtt + * Free MQTT client instance + * @param client Pointer to instance to be freed + */ +void +mqtt_client_free(mqtt_client_t* client) +{ + mem_free(client); +} /** * @ingroup mqtt diff --git a/src/include/lwip/apps/mqtt.h b/src/include/lwip/apps/mqtt.h index 0007e40b..c4f1a6dd 100644 --- a/src/include/lwip/apps/mqtt.h +++ b/src/include/lwip/apps/mqtt.h @@ -179,8 +179,8 @@ err_t mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ipaddr, u16_t /** Disconnect from server */ void mqtt_disconnect(mqtt_client_t *client); -/** Create new client */ mqtt_client_t *mqtt_client_new(void); +void mqtt_client_free(mqtt_client_t* client); /** Check connection status */ u8_t mqtt_client_is_connected(mqtt_client_t *client);