[PATCH 4/12] bug fix: openssh-4.3p2 memory leak

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


If the operation in the function is not allowed memory is leaked in
three variables which were xmalloc'ed with buffer_get_string.  In the
allowed case these variables are pointed to by variables with a greater
scope thus the reason this is a condtional leak.  This entire set of
patches passed the regression tests on my system. Resource leak bugs
found by Coverity.
        
Signed-off-by: Kylene Hall <kjhall at us.ibm.com>
---
monitor.c |    4 ++++
1 files changed, 4 insertions(+)

diff -uprN openssh-4.3p2/monitor.c openssh-4.3p2-kylie/monitor.c
--- openssh-4.3p2/monitor.c	2005-11-04 22:07:05.000000000 -0600
+++ openssh-4.3p2-kylie/monitor.c	2006-05-08 17:18:15.697809744 -0500
@@ -1010,6 +1010,10 @@ mm_answer_keyallowed(int sock, Buffer *m
 		key_blobtype = type;
 		hostbased_cuser = cuser;
 		hostbased_chost = chost;
+	} else { 
+		xfree(blob);
+		xfree(chost);
+		xfree(cuser);
 	}
 
 	debug3("%s: key %p is %s",





More information about the openssh-unix-dev mailing list