From 74f9a06192ad34ccb8483267e00f7f0233014164 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Wed, 6 Dec 2023 13:06:45 +0000 Subject: [PATCH] Clear buffer when done processing fragmented data to free the memory (#289) --- src/transport/multicast/tx.c | 3 +++ src/transport/unicast/tx.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/transport/multicast/tx.c b/src/transport/multicast/tx.c index e3e0c9b71..3d5b18c0d 100644 --- a/src/transport/multicast/tx.c +++ b/src/transport/multicast/tx.c @@ -143,6 +143,9 @@ int8_t _z_multicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_m } } } + + // Clear the buffer as it's no longer required + _z_wbuf_clear(&fbf); } } diff --git a/src/transport/unicast/tx.c b/src/transport/unicast/tx.c index 21694e1e9..f2ac6feee 100644 --- a/src/transport/unicast/tx.c +++ b/src/transport/unicast/tx.c @@ -152,6 +152,9 @@ int8_t _z_unicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg } } } + + // Clear the buffer as it's no longer required + _z_wbuf_clear(&fbf); } }