summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2017-06-30 04:17:23 +0000
committerDamien Miller <djm@mindrot.org>2017-06-30 16:07:55 +1000
commitd79bceb9311a9c137d268f5bc481705db4151810 (patch)
treeaaa0be17ac8136b876b52ce55e66da27ba98ee2e /ssh-keyscan.c
parent197dc9728f062e23ce374f44c95a2b5f9ffa4075 (diff)
upstream commit
Only call close once in confree(). ssh_packet_close will close the FD so only explicitly close non-SSH channels. bz#2734, from bagajjal at microsoft.com, ok djm@ Upstream-ID: a81ce0c8b023527167739fccf1732b154718ab02
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 2767e7d5f..258123ae8 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.114 2017/05/31 07:00:13 markus Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.115 2017/06/30 04:17:23 dtucker Exp $ */
2/* 2/*
3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
4 * 4 *
@@ -390,7 +390,6 @@ confree(int s)
390{ 390{
391 if (s >= maxfd || fdcon[s].c_status == CS_UNUSED) 391 if (s >= maxfd || fdcon[s].c_status == CS_UNUSED)
392 fatal("confree: attempt to free bad fdno %d", s); 392 fatal("confree: attempt to free bad fdno %d", s);
393 close(s);
394 free(fdcon[s].c_namebase); 393 free(fdcon[s].c_namebase);
395 free(fdcon[s].c_output_name); 394 free(fdcon[s].c_output_name);
396 if (fdcon[s].c_status == CS_KEYS) 395 if (fdcon[s].c_status == CS_KEYS)
@@ -401,7 +400,8 @@ confree(int s)
401 ssh_packet_close(fdcon[s].c_ssh); 400 ssh_packet_close(fdcon[s].c_ssh);
402 free(fdcon[s].c_ssh); 401 free(fdcon[s].c_ssh);
403 fdcon[s].c_ssh = NULL; 402 fdcon[s].c_ssh = NULL;
404 } 403 } else
404 close(s);
405 TAILQ_REMOVE(&tq, &fdcon[s], c_link); 405 TAILQ_REMOVE(&tq, &fdcon[s], c_link);
406 FD_CLR(s, read_wait); 406 FD_CLR(s, read_wait);
407 ncon--; 407 ncon--;