Skip to content

Commit

Permalink
fix the ownership bug to avoid generate dangling pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
kynehc committed Jan 18, 2025
1 parent c799337 commit ac4584a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,10 @@ impl Session {
unsafe {
let ret = raw::libssh2_channel_forward_listen_ex(
inner.raw,
host.map(|s| s.as_ptr()).unwrap_or(null()),
host
.as_ref()
.map(|s| s.as_ptr())
.unwrap_or(null()),
remote_port as c_int,
&mut bound_port,
queue_maxsize.unwrap_or(0) as c_int,
Expand Down

0 comments on commit ac4584a

Please sign in to comment.