changeset 13865:6fa12cf47ebb

3285 memory leaks in libsldap Reviewed by: Gordon Ross <Gordon.Ross@nexenta.com> Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com> Reviewed by: Vitaliy Gusev <vitaliy.gusev@nexenta.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Richard Lowe <richlowe@richlowe.net>
author Hans Rosenfeld <hans.rosenfeld@nexenta.com>
date Thu, 18 Oct 2012 12:22:08 -0500
parents 2737b2ab1b9e
children 040f4b0699ee
files usr/src/lib/libsldap/common/ns_connect.c usr/src/lib/libsldap/common/ns_standalone.c
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libsldap/common/ns_connect.c	Fri Sep 07 23:51:24 2012 -0400
+++ b/usr/src/lib/libsldap/common/ns_connect.c	Thu Oct 18 12:22:08 2012 -0500
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  */
 
 #include <stdlib.h>
@@ -475,10 +476,10 @@
 		return;
 	}
 
-	(void) fprintf(fp, "tid= %d: AuthType=%d", t, cred->auth.type);
-	(void) fprintf(fp, "tid= %d: TlsType=%d", t, cred->auth.tlstype);
-	(void) fprintf(fp, "tid= %d: SaslMech=%d", t, cred->auth.saslmech);
-	(void) fprintf(fp, "tid= %d: SaslOpt=%d", t, cred->auth.saslopt);
+	(void) fprintf(fp, "tid= %d: AuthType=%d\n", t, cred->auth.type);
+	(void) fprintf(fp, "tid= %d: TlsType=%d\n", t, cred->auth.tlstype);
+	(void) fprintf(fp, "tid= %d: SaslMech=%d\n", t, cred->auth.saslmech);
+	(void) fprintf(fp, "tid= %d: SaslOpt=%d\n", t, cred->auth.saslopt);
 	if (cred->hostcertpath)
 		(void) fprintf(fp, "tid= %d: hostCertPath=%s\n",
 		    t, cred->hostcertpath);
@@ -701,7 +702,8 @@
 
 	if (conp == NULL || errorp == NULL || auth == NULL)
 		return (NS_LDAP_INVALID_PARAM);
-	*errorp = NULL;
+	if (*errorp)
+		(void) __ns_ldap_freeError(errorp);
 	*conp = NULL;
 	(void) memset(&sinfo, 0, sizeof (sinfo));
 
--- a/usr/src/lib/libsldap/common/ns_standalone.c	Fri Sep 07 23:51:24 2012 -0400
+++ b/usr/src/lib/libsldap/common/ns_standalone.c	Thu Oct 18 12:22:08 2012 -0500
@@ -22,6 +22,7 @@
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  * Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  */
 
 #define	__STANDALONE_MODULE__
@@ -1450,6 +1451,7 @@
 		}
 
 		__s_api_conn_user_free(cu);
+		DropConnection(sessionId, NS_LDAP_NEW_CONN);
 		return (NS_LDAP_OP_FAILED);
 	}
 	__s_api_conn_user_free(cu);