diff options
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/serverloop.c b/serverloop.c index a61d4ad32..7c250b22f 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.c,v 1.166 2013/05/16 09:08:41 dtucker Exp $ */ | 1 | /* $OpenBSD: serverloop.c,v 1.167 2013/05/17 00:13:14 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 |
@@ -694,7 +694,7 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) | |||
694 | /* Display list of open channels. */ | 694 | /* Display list of open channels. */ |
695 | cp = channel_open_message(); | 695 | cp = channel_open_message(); |
696 | buffer_append(&stderr_buffer, cp, strlen(cp)); | 696 | buffer_append(&stderr_buffer, cp, strlen(cp)); |
697 | xfree(cp); | 697 | free(cp); |
698 | } | 698 | } |
699 | } | 699 | } |
700 | max_fd = MAX(connection_in, connection_out); | 700 | max_fd = MAX(connection_in, connection_out); |
@@ -722,10 +722,8 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) | |||
722 | /* Process output to the client and to program stdin. */ | 722 | /* Process output to the client and to program stdin. */ |
723 | process_output(writeset); | 723 | process_output(writeset); |
724 | } | 724 | } |
725 | if (readset) | 725 | free(readset); |
726 | xfree(readset); | 726 | free(writeset); |
727 | if (writeset) | ||
728 | xfree(writeset); | ||
729 | 727 | ||
730 | /* Cleanup and termination code. */ | 728 | /* Cleanup and termination code. */ |
731 | 729 | ||
@@ -885,10 +883,8 @@ server_loop2(Authctxt *authctxt) | |||
885 | } | 883 | } |
886 | collect_children(); | 884 | collect_children(); |
887 | 885 | ||
888 | if (readset) | 886 | free(readset); |
889 | xfree(readset); | 887 | free(writeset); |
890 | if (writeset) | ||
891 | xfree(writeset); | ||
892 | 888 | ||
893 | /* free all channels, no more reads and writes */ | 889 | /* free all channels, no more reads and writes */ |
894 | channel_free_all(); | 890 | channel_free_all(); |
@@ -923,7 +919,7 @@ server_input_stdin_data(int type, u_int32_t seq, void *ctxt) | |||
923 | packet_check_eom(); | 919 | packet_check_eom(); |
924 | buffer_append(&stdin_buffer, data, data_len); | 920 | buffer_append(&stdin_buffer, data, data_len); |
925 | memset(data, 0, data_len); | 921 | memset(data, 0, data_len); |
926 | xfree(data); | 922 | free(data); |
927 | } | 923 | } |
928 | 924 | ||
929 | static void | 925 | static void |
@@ -980,8 +976,8 @@ server_request_direct_tcpip(void) | |||
980 | originator, originator_port, target, target_port); | 976 | originator, originator_port, target, target_port); |
981 | } | 977 | } |
982 | 978 | ||
983 | xfree(originator); | 979 | free(originator); |
984 | xfree(target); | 980 | free(target); |
985 | 981 | ||
986 | return c; | 982 | return c; |
987 | } | 983 | } |
@@ -1110,7 +1106,7 @@ server_input_channel_open(int type, u_int32_t seq, void *ctxt) | |||
1110 | } | 1106 | } |
1111 | packet_send(); | 1107 | packet_send(); |
1112 | } | 1108 | } |
1113 | xfree(ctype); | 1109 | free(ctype); |
1114 | } | 1110 | } |
1115 | 1111 | ||
1116 | static void | 1112 | static void |
@@ -1155,7 +1151,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1155 | listen_address, listen_port, | 1151 | listen_address, listen_port, |
1156 | &allocated_listen_port, options.gateway_ports); | 1152 | &allocated_listen_port, options.gateway_ports); |
1157 | } | 1153 | } |
1158 | xfree(listen_address); | 1154 | free(listen_address); |
1159 | } else if (strcmp(rtype, "cancel-tcpip-forward") == 0) { | 1155 | } else if (strcmp(rtype, "cancel-tcpip-forward") == 0) { |
1160 | char *cancel_address; | 1156 | char *cancel_address; |
1161 | u_short cancel_port; | 1157 | u_short cancel_port; |
@@ -1167,7 +1163,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1167 | 1163 | ||
1168 | success = channel_cancel_rport_listener(cancel_address, | 1164 | success = channel_cancel_rport_listener(cancel_address, |
1169 | cancel_port); | 1165 | cancel_port); |
1170 | xfree(cancel_address); | 1166 | free(cancel_address); |
1171 | } else if (strcmp(rtype, "no-more-sessions@openssh.com") == 0) { | 1167 | } else if (strcmp(rtype, "no-more-sessions@openssh.com") == 0) { |
1172 | no_more_sessions = 1; | 1168 | no_more_sessions = 1; |
1173 | success = 1; | 1169 | success = 1; |
@@ -1180,7 +1176,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1180 | packet_send(); | 1176 | packet_send(); |
1181 | packet_write_wait(); | 1177 | packet_write_wait(); |
1182 | } | 1178 | } |
1183 | xfree(rtype); | 1179 | free(rtype); |
1184 | } | 1180 | } |
1185 | 1181 | ||
1186 | static void | 1182 | static void |
@@ -1212,7 +1208,7 @@ server_input_channel_req(int type, u_int32_t seq, void *ctxt) | |||
1212 | packet_put_int(c->remote_id); | 1208 | packet_put_int(c->remote_id); |
1213 | packet_send(); | 1209 | packet_send(); |
1214 | } | 1210 | } |
1215 | xfree(rtype); | 1211 | free(rtype); |
1216 | } | 1212 | } |
1217 | 1213 | ||
1218 | static void | 1214 | static void |