From 5790b5910bfc3de69e0886953f9c09341f3fd951 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 26 Mar 2006 13:54:03 +1100 Subject: [PATCH] - djm@cvs.openbsd.org 2006/03/19 07:41:30 [sshconnect2.c] memory leaks detected by Coverity via elad AT netbsd.org; deraadt@ ok --- ChangeLog | 6 +++++- sshconnect2.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19425d867..5a46102ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,10 @@ [dh.c readconf.c servconf.c] potential NULL pointer dereferences detected by Coverity via elad AT netbsd.org; ok deraadt@ + - djm@cvs.openbsd.org 2006/03/19 07:41:30 + [sshconnect2.c] + memory leaks detected by Coverity via elad AT netbsd.org; + deraadt@ ok 20060325 - OpenBSD CVS Sync @@ -4287,4 +4291,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.4249 2006/03/26 02:53:32 djm Exp $ +$Id: ChangeLog,v 1.4250 2006/03/26 02:54:12 djm Exp $ diff --git a/sshconnect2.c b/sshconnect2.c index b7aa96e39..f8d21489e 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -513,8 +513,10 @@ userauth_gssapi(Authctxt *authctxt) } } - if (!ok) + if (!ok) { + ssh_gssapi_delete_ctx(&gssctxt); return 0; + } authctxt->methoddata=(void *)gssctxt; @@ -1330,6 +1332,7 @@ userauth_hostbased(Authctxt *authctxt) if (p == NULL) { error("userauth_hostbased: cannot get local ipaddr/name"); key_free(private); + xfree(blob); return 0; } len = strlen(p) + 2; @@ -1368,6 +1371,7 @@ userauth_hostbased(Authctxt *authctxt) error("key_sign failed"); xfree(chost); xfree(pkalg); + xfree(blob); return 0; } packet_start(SSH2_MSG_USERAUTH_REQUEST); @@ -1383,6 +1387,7 @@ userauth_hostbased(Authctxt *authctxt) xfree(signature); xfree(chost); xfree(pkalg); + xfree(blob); packet_send(); return 1;