[PATCH 3/12] bug fix: openssh-4.3p2 resource leak

Kylene Jo Hall kjhall at us.ibm.com
Tue May 16 06:19:01 EST 2006


The file descriptor f is not closed in this error path.  This patch adds
the fclose as is customary in the rest of the function.  This entire set
of patches passed the regression tests on my system. Resource leak bug
found by Coverity.

Signed-off-by: Kylene Hall <kjhall at us.ibm.com>
---
hostfile.c |    4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -uprN openssh-4.3p2/hostfile.c openssh-4.3p2-kylie/hostfile.c
--- openssh-4.3p2/hostfile.c	2005-11-22 02:43:27.000000000 -0600
+++ openssh-4.3p2-kylie/hostfile.c	2006-05-04 13:51:10.000000000 -0500
@@ -254,8 +254,10 @@ check_host_in_hostfile_by_key_or_type(co
 
 		if (key == NULL) {
 			/* we found a key of the requested type */
-			if (found->type == keytype)
+			if (found->type == keytype) {
+				fclose(f);
 				return HOST_FOUND;
+			}
 			continue;
 		}
 





More information about the openssh-unix-dev mailing list