summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-02-06 11:18:51 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-02-06 11:18:51 -0800
commitef90d566f010d9fd997ccd2d0c68081efd26db32 (patch)
tree16efe41b754bf69655fee17ec1c58997c09b88ef /tests
parent8fda2fcd6af9a7dc3add386f522ed38388774f16 (diff)
downloadssh2-rs-ef90d566f010d9fd997ccd2d0c68081efd26db32.zip
Don't assert free returns 0 in a dtor
This may return EAGAIN, but we'll just make things worse by aborting. Instead just unfortunately leak the memory as there's not much more that can be done.
Diffstat (limited to 'tests')
-rw-r--r--tests/channel.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/channel.rs b/tests/channel.rs
index 94b7cf8..9cced14 100644
--- a/tests/channel.rs
+++ b/tests/channel.rs
@@ -106,3 +106,21 @@ fn forward() {
assert_eq!(r, [4, 5, 6]);
t.join().ok().unwrap();
}
+
+#[test]
+fn drop_nonblocking() {
+ let listener = TcpListener::bind("127.0.0.1:0").unwrap();
+ let addr = listener.local_addr().unwrap();
+
+ let (_tcp, sess) = ::authed_session();
+ sess.set_blocking(false);
+
+ let t = thread::spawn(move || {
+ let _s = listener.accept().unwrap();
+ });
+
+ let _ = sess.channel_direct_tcpip("127.0.0.1", addr.port(), None);
+ drop(sess);
+
+ t.join().unwrap();
+}