From 50f02139009d00c52b65a113d5b6a919d3fa8c54 Mon Sep 17 00:00:00 2001 From: Darius Maitia Date: Wed, 6 Mar 2024 10:40:55 +0100 Subject: [PATCH] Fix user attachment bytes not beeing freed. (#47) --- zenoh-jni/src/query.rs | 3 +++ zenoh-jni/src/reply.rs | 3 +++ zenoh-jni/src/subscriber.rs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/zenoh-jni/src/query.rs b/zenoh-jni/src/query.rs index 333b6cfc..927f2f4f 100644 --- a/zenoh-jni/src/query.rs +++ b/zenoh-jni/src/query.rs @@ -293,6 +293,9 @@ pub(crate) fn on_query( _ = env .delete_local_ref(payload) .map_err(|err| log::error!("Error deleting local ref: {}", err)); + _ = env + .delete_local_ref(attachment_bytes) + .map_err(|err| log::error!("Error deleting local ref: {}", err)); result } diff --git a/zenoh-jni/src/reply.rs b/zenoh-jni/src/reply.rs index f3660a03..3737ede4 100644 --- a/zenoh-jni/src/reply.rs +++ b/zenoh-jni/src/reply.rs @@ -103,6 +103,9 @@ fn on_reply_success( _ = env .delete_local_ref(byte_array) .map_err(|err| log::debug!("Error deleting local ref: {}", err)); + _ = env + .delete_local_ref(attachment_bytes) + .map_err(|err| log::debug!("Error deleting local ref: {}", err)); result } diff --git a/zenoh-jni/src/subscriber.rs b/zenoh-jni/src/subscriber.rs index ae99f351..2c269608 100644 --- a/zenoh-jni/src/subscriber.rs +++ b/zenoh-jni/src/subscriber.rs @@ -154,6 +154,9 @@ pub(crate) unsafe fn declare_subscriber( _ = env .delete_local_ref(byte_array) .map_err(|err| log::debug!("Error deleting local ref: {}", err)); + _ = env + .delete_local_ref(attachment_bytes) + .map_err(|err| log::debug!("Error deleting local ref: {}", err)); }) .reliability(reliability) .res();