Print this page
3285 memory leaks in libsldap

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  */
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>

@@ -473,14 +474,14 @@
         if (cred == NULL) {
                 (void) fprintf(fp, "tid= %d: printCred: cred is NULL\n", t);
                 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);
         if (cred->cred.unix_cred.userID)
                 (void) fprintf(fp, "tid= %d: userID=%s\n",

@@ -699,11 +700,12 @@
         char *serverAddrType = NULL, **bindHost = NULL;
 
 
         if (conp == NULL || errorp == NULL || auth == NULL)
                 return (NS_LDAP_INVALID_PARAM);
-        *errorp = NULL;
+        if (*errorp)
+                __ns_ldap_freeError(errorp);
         *conp = NULL;
         (void) memset(&sinfo, 0, sizeof (sinfo));
 
         if ((id = findConnection(flags, serverAddr, auth, &con)) != -1) {
                 /* connection found in cache */