Skip to content

Commit ac4584a

Browse files
committed
fix the ownership bug to avoid generate dangling pointer
1 parent c799337 commit ac4584a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/session.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,10 @@ impl Session {
838838
unsafe {
839839
let ret = raw::libssh2_channel_forward_listen_ex(
840840
inner.raw,
841-
host.map(|s| s.as_ptr()).unwrap_or(null()),
841+
host
842+
.as_ref()
843+
.map(|s| s.as_ptr())
844+
.unwrap_or(null()),
842845
remote_port as c_int,
843846
&mut bound_port,
844847
queue_maxsize.unwrap_or(0) as c_int,

0 commit comments

Comments
 (0)