Skip to content

Commit

Permalink
fix(mem leak): user attachment bytes not being freed (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIMP authored Mar 6, 2024
1 parent 0bb75c9 commit 4d3d46a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zenoh-jni/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions zenoh-jni/src/reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions zenoh-jni/src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4d3d46a

Please sign in to comment.