From 6e455e0f9936dcfe053b39cd945710f8e9353318 Mon Sep 17 00:00:00 2001 From: Jean-Roland Date: Fri, 14 Jun 2024 15:56:17 +0200 Subject: [PATCH] fix: copy attachment --- src/net/reply.c | 2 +- src/net/sample.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/reply.c b/src/net/reply.c index 8c42833b9..9dfc5c4fb 100644 --- a/src/net/reply.c +++ b/src/net/reply.c @@ -98,7 +98,7 @@ _z_reply_t _z_reply_create(_z_keyexpr_t keyexpr, z_reply_tag_t tag, _z_id_t id, _z_slice_copy(&sample.payload._slice, payload); sample.kind = kind; sample.timestamp = _z_timestamp_duplicate(timestamp); - sample.attachment = att; // FIXME: call z_attachment_move or copy + sample.attachment = _z_bytes_duplicate(&att); // Create sample rc from value reply.data.sample = _z_sample_rc_new_from_val(sample); diff --git a/src/net/sample.c b/src/net/sample.c index f71744358..7ceca0f2f 100644 --- a/src/net/sample.c +++ b/src/net/sample.c @@ -88,7 +88,7 @@ _z_sample_t _z_sample_create(const _z_keyexpr_t *key, const _z_slice_t *payload, s.kind = kind; s.timestamp = timestamp; s.qos = qos; - s.attachment = att; // FIXME: call z_attachment_move or copy + s.attachment = _z_bytes_duplicate(&att); return s; } #else