~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Sebastian Kuschel reports that pfd_closing can be called for a socket
[sgt/putty]
/
portfwd.c
diff --git
a/portfwd.c
b/portfwd.c
index
70b8910
..
00cff5e
100644
(file)
--- a/
portfwd.c
+++ b/
portfwd.c
@@
-87,7
+87,17
@@
static int pfd_closing(Plug plug, const char *error_msg, int error_code,
/*
* Socket error. Slam the connection instantly shut.
*/
/*
* Socket error. Slam the connection instantly shut.
*/
- sshfwd_unclean_close(pr->c);
+ if (pr->c) {
+ sshfwd_unclean_close(pr->c);
+ } else {
+ /*
+ * We might not have an SSH channel, if a socket error
+ * occurred during SOCKS negotiation. If not, we must
+ * clean ourself up without sshfwd_unclean_close's call
+ * back to pfd_close.
+ */
+ pfd_close(pr->s);
+ }
} else {
/*
* Ordinary EOF received on socket. Send an EOF on the SSH
} else {
/*
* Ordinary EOF received on socket. Send an EOF on the SSH
@@
-370,6
+380,7
@@
const char *pfd_newconnect(Socket *s, char *hostname, int port,
addr = name_lookup(hostname, port, &dummy_realhost, conf, addressfamily);
if ((err = sk_addr_error(addr)) != NULL) {
sk_addr_free(addr);
addr = name_lookup(hostname, port, &dummy_realhost, conf, addressfamily);
if ((err = sk_addr_error(addr)) != NULL) {
sk_addr_free(addr);
+ sfree(dummy_realhost);
return err;
}
return err;
}
@@
-386,6
+397,7
@@
const char *pfd_newconnect(Socket *s, char *hostname, int port,
pr->s = *s = new_connection(addr, dummy_realhost, port,
0, 1, 0, 0, (Plug) pr, conf);
pr->s = *s = new_connection(addr, dummy_realhost, port,
0, 1, 0, 0, (Plug) pr, conf);
+ sfree(dummy_realhost);
if ((err = sk_socket_error(*s)) != NULL) {
free_portfwd_private(pr);
return err;
if ((err = sk_socket_error(*s)) != NULL) {
free_portfwd_private(pr);
return err;