diff options
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/clientloop.c b/clientloop.c index f1b108fcd..22138560b 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.249 2013/05/16 02:00:34 dtucker Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.250 2013/05/17 00:13:13 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -393,10 +393,8 @@ client_x11_get_proto(const char *display, const char *xauth_path, | |||
393 | unlink(xauthfile); | 393 | unlink(xauthfile); |
394 | rmdir(xauthdir); | 394 | rmdir(xauthdir); |
395 | } | 395 | } |
396 | if (xauthdir) | 396 | free(xauthdir); |
397 | xfree(xauthdir); | 397 | free(xauthfile); |
398 | if (xauthfile) | ||
399 | xfree(xauthfile); | ||
400 | 398 | ||
401 | /* | 399 | /* |
402 | * If we didn't get authentication data, just make up some | 400 | * If we didn't get authentication data, just make up some |
@@ -552,7 +550,7 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt) | |||
552 | if (--gc->ref_count <= 0) { | 550 | if (--gc->ref_count <= 0) { |
553 | TAILQ_REMOVE(&global_confirms, gc, entry); | 551 | TAILQ_REMOVE(&global_confirms, gc, entry); |
554 | bzero(gc, sizeof(*gc)); | 552 | bzero(gc, sizeof(*gc)); |
555 | xfree(gc); | 553 | free(gc); |
556 | } | 554 | } |
557 | 555 | ||
558 | packet_set_alive_timeouts(0); | 556 | packet_set_alive_timeouts(0); |
@@ -826,13 +824,13 @@ client_status_confirm(int type, Channel *c, void *ctx) | |||
826 | chan_write_failed(c); | 824 | chan_write_failed(c); |
827 | } | 825 | } |
828 | } | 826 | } |
829 | xfree(cr); | 827 | free(cr); |
830 | } | 828 | } |
831 | 829 | ||
832 | static void | 830 | static void |
833 | client_abandon_status_confirm(Channel *c, void *ctx) | 831 | client_abandon_status_confirm(Channel *c, void *ctx) |
834 | { | 832 | { |
835 | xfree(ctx); | 833 | free(ctx); |
836 | } | 834 | } |
837 | 835 | ||
838 | void | 836 | void |
@@ -999,12 +997,9 @@ process_cmdline(void) | |||
999 | out: | 997 | out: |
1000 | signal(SIGINT, handler); | 998 | signal(SIGINT, handler); |
1001 | enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); | 999 | enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
1002 | if (cmd) | 1000 | free(cmd); |
1003 | xfree(cmd); | 1001 | free(fwd.listen_host); |
1004 | if (fwd.listen_host != NULL) | 1002 | free(fwd.connect_host); |
1005 | xfree(fwd.listen_host); | ||
1006 | if (fwd.connect_host != NULL) | ||
1007 | xfree(fwd.connect_host); | ||
1008 | } | 1003 | } |
1009 | 1004 | ||
1010 | /* reasons to suppress output of an escape command in help output */ | 1005 | /* reasons to suppress output of an escape command in help output */ |
@@ -1261,7 +1256,7 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, | |||
1261 | buffer_append(berr, string, strlen(string)); | 1256 | buffer_append(berr, string, strlen(string)); |
1262 | s = channel_open_message(); | 1257 | s = channel_open_message(); |
1263 | buffer_append(berr, s, strlen(s)); | 1258 | buffer_append(berr, s, strlen(s)); |
1264 | xfree(s); | 1259 | free(s); |
1265 | continue; | 1260 | continue; |
1266 | 1261 | ||
1267 | case 'C': | 1262 | case 'C': |
@@ -1450,7 +1445,7 @@ client_new_escape_filter_ctx(int escape_char) | |||
1450 | void | 1445 | void |
1451 | client_filter_cleanup(int cid, void *ctx) | 1446 | client_filter_cleanup(int cid, void *ctx) |
1452 | { | 1447 | { |
1453 | xfree(ctx); | 1448 | free(ctx); |
1454 | } | 1449 | } |
1455 | 1450 | ||
1456 | int | 1451 | int |
@@ -1661,10 +1656,8 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1661 | } | 1656 | } |
1662 | } | 1657 | } |
1663 | } | 1658 | } |
1664 | if (readset) | 1659 | free(readset); |
1665 | xfree(readset); | 1660 | free(writeset); |
1666 | if (writeset) | ||
1667 | xfree(writeset); | ||
1668 | 1661 | ||
1669 | /* Terminate the session. */ | 1662 | /* Terminate the session. */ |
1670 | 1663 | ||
@@ -1766,7 +1759,7 @@ client_input_stdout_data(int type, u_int32_t seq, void *ctxt) | |||
1766 | packet_check_eom(); | 1759 | packet_check_eom(); |
1767 | buffer_append(&stdout_buffer, data, data_len); | 1760 | buffer_append(&stdout_buffer, data, data_len); |
1768 | memset(data, 0, data_len); | 1761 | memset(data, 0, data_len); |
1769 | xfree(data); | 1762 | free(data); |
1770 | } | 1763 | } |
1771 | static void | 1764 | static void |
1772 | client_input_stderr_data(int type, u_int32_t seq, void *ctxt) | 1765 | client_input_stderr_data(int type, u_int32_t seq, void *ctxt) |
@@ -1776,7 +1769,7 @@ client_input_stderr_data(int type, u_int32_t seq, void *ctxt) | |||
1776 | packet_check_eom(); | 1769 | packet_check_eom(); |
1777 | buffer_append(&stderr_buffer, data, data_len); | 1770 | buffer_append(&stderr_buffer, data, data_len); |
1778 | memset(data, 0, data_len); | 1771 | memset(data, 0, data_len); |
1779 | xfree(data); | 1772 | free(data); |
1780 | } | 1773 | } |
1781 | static void | 1774 | static void |
1782 | client_input_exit_status(int type, u_int32_t seq, void *ctxt) | 1775 | client_input_exit_status(int type, u_int32_t seq, void *ctxt) |
@@ -1856,8 +1849,8 @@ client_request_forwarded_tcpip(const char *request_type, int rchan) | |||
1856 | c = channel_connect_by_listen_address(listen_port, | 1849 | c = channel_connect_by_listen_address(listen_port, |
1857 | "forwarded-tcpip", originator_address); | 1850 | "forwarded-tcpip", originator_address); |
1858 | 1851 | ||
1859 | xfree(originator_address); | 1852 | free(originator_address); |
1860 | xfree(listen_address); | 1853 | free(listen_address); |
1861 | return c; | 1854 | return c; |
1862 | } | 1855 | } |
1863 | 1856 | ||
@@ -1891,7 +1884,7 @@ client_request_x11(const char *request_type, int rchan) | |||
1891 | /* XXX check permission */ | 1884 | /* XXX check permission */ |
1892 | debug("client_request_x11: request from %s %d", originator, | 1885 | debug("client_request_x11: request from %s %d", originator, |
1893 | originator_port); | 1886 | originator_port); |
1894 | xfree(originator); | 1887 | free(originator); |
1895 | sock = x11_connect_display(); | 1888 | sock = x11_connect_display(); |
1896 | if (sock < 0) | 1889 | if (sock < 0) |
1897 | return NULL; | 1890 | return NULL; |
@@ -2018,7 +2011,7 @@ client_input_channel_open(int type, u_int32_t seq, void *ctxt) | |||
2018 | } | 2011 | } |
2019 | packet_send(); | 2012 | packet_send(); |
2020 | } | 2013 | } |
2021 | xfree(ctype); | 2014 | free(ctype); |
2022 | } | 2015 | } |
2023 | static void | 2016 | static void |
2024 | client_input_channel_req(int type, u_int32_t seq, void *ctxt) | 2017 | client_input_channel_req(int type, u_int32_t seq, void *ctxt) |
@@ -2064,7 +2057,7 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt) | |||
2064 | packet_put_int(c->remote_id); | 2057 | packet_put_int(c->remote_id); |
2065 | packet_send(); | 2058 | packet_send(); |
2066 | } | 2059 | } |
2067 | xfree(rtype); | 2060 | free(rtype); |
2068 | } | 2061 | } |
2069 | static void | 2062 | static void |
2070 | client_input_global_request(int type, u_int32_t seq, void *ctxt) | 2063 | client_input_global_request(int type, u_int32_t seq, void *ctxt) |
@@ -2083,7 +2076,7 @@ client_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
2083 | packet_send(); | 2076 | packet_send(); |
2084 | packet_write_wait(); | 2077 | packet_write_wait(); |
2085 | } | 2078 | } |
2086 | xfree(rtype); | 2079 | free(rtype); |
2087 | } | 2080 | } |
2088 | 2081 | ||
2089 | void | 2082 | void |
@@ -2133,7 +2126,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem, | |||
2133 | /* Split */ | 2126 | /* Split */ |
2134 | name = xstrdup(env[i]); | 2127 | name = xstrdup(env[i]); |
2135 | if ((val = strchr(name, '=')) == NULL) { | 2128 | if ((val = strchr(name, '=')) == NULL) { |
2136 | xfree(name); | 2129 | free(name); |
2137 | continue; | 2130 | continue; |
2138 | } | 2131 | } |
2139 | *val++ = '\0'; | 2132 | *val++ = '\0'; |
@@ -2147,7 +2140,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem, | |||
2147 | } | 2140 | } |
2148 | if (!matched) { | 2141 | if (!matched) { |
2149 | debug3("Ignored env %s", name); | 2142 | debug3("Ignored env %s", name); |
2150 | xfree(name); | 2143 | free(name); |
2151 | continue; | 2144 | continue; |
2152 | } | 2145 | } |
2153 | 2146 | ||
@@ -2156,7 +2149,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem, | |||
2156 | packet_put_cstring(name); | 2149 | packet_put_cstring(name); |
2157 | packet_put_cstring(val); | 2150 | packet_put_cstring(val); |
2158 | packet_send(); | 2151 | packet_send(); |
2159 | xfree(name); | 2152 | free(name); |
2160 | } | 2153 | } |
2161 | } | 2154 | } |
2162 | 2155 | ||