From 9ca8cc170e6880de65e3efe17699617299ce42f6 Mon Sep 17 00:00:00 2001 From: Yuyuan Yuan Date: Wed, 8 Jan 2025 17:55:15 +0800 Subject: [PATCH] fix: resolve the memory leak in the string deserialization (#363) * fix: resolve the memory leak in the string deserialization * chore: apply the suggestion Co-authored-by: DenisBiryukov91 <155981813+DenisBiryukov91@users.noreply.github.com> --------- Co-authored-by: DenisBiryukov91 <155981813+DenisBiryukov91@users.noreply.github.com> --- include/zenoh/api/ext/serialization.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/include/zenoh/api/ext/serialization.hxx b/include/zenoh/api/ext/serialization.hxx index b235462..7ac81b6 100644 --- a/include/zenoh/api/ext/serialization.hxx +++ b/include/zenoh/api/ext/serialization.hxx @@ -278,6 +278,7 @@ inline bool __zenoh_deserialize_with_deserializer(zenoh::ext::Deserializer& dese __ZENOH_RESULT_CHECK(::ze_deserializer_deserialize_string(interop::as_copyable_c_ptr(deserializer), &s), err, "Deserialization failure"); value = std::string(::z_string_data(::z_loan(s)), ::z_string_len(::z_loan(s))); + ::z_drop(::z_move(s)); return err == nullptr || *err == Z_OK; }