From 41d5e7c6ac7addc6adcbb5de918e08bb63cf0fdd Mon Sep 17 00:00:00 2001 From: Henrik Maier Date: Tue, 22 Dec 2020 19:18:53 +1000 Subject: [PATCH] A call to nxd_mqtt_client_message_get() with insufficient memory will now report the actual memory required in actual_topic_length and actual_message_length. A caller can then allocate the required memory and repeat the call. --- addons/mqtt/nxd_mqtt_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mqtt/nxd_mqtt_client.c b/addons/mqtt/nxd_mqtt_client.c index 5915e7a1..f879478e 100644 --- a/addons/mqtt/nxd_mqtt_client.c +++ b/addons/mqtt/nxd_mqtt_client.c @@ -5218,6 +5218,8 @@ ULONG message_length; if ((topic_buffer_size < topic_length) || (message_buffer_size < message_length)) { + *actual_topic_length = topic_length; + *actual_message_length = message_length; tx_mutex_put(client_ptr -> nxd_mqtt_client_mutex_ptr); return(NXD_MQTT_INSUFFICIENT_BUFFER_SPACE); }