Skip to content

Commit 90b2988

Browse files
authored
Merge pull request #345 from quitbug/master
fix the ownership bug to avoid generate dangling pointer
2 parents 29bea56 + ac4584a commit 90b2988

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)