summaryrefslogtreecommitdiff
path: root/usr/src/lib/libldap5
diff options
context:
space:
mode:
authorMilan Jurik <Milan.Jurik@Sun.COM>2009-08-09 09:20:12 +0100
committerMilan Jurik <Milan.Jurik@Sun.COM>2009-08-09 09:20:12 +0100
commite944850b16b5f1c0446b0e09400846b63b1ee8a3 (patch)
treefad6e2028b8a841681f7726c6da2a87b7fc45ea5 /usr/src/lib/libldap5
parent93a61d92901e899ac53171c1afb6286ed37a0670 (diff)
downloadillumos-gate-e944850b16b5f1c0446b0e09400846b63b1ee8a3.tar.gz
6846156 memleak in prldap_connect()
Diffstat (limited to 'usr/src/lib/libldap5')
-rw-r--r--usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c b/usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c
index 824a8ca212..2902a94aa0 100644
--- a/usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c
+++ b/usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c
@@ -1,11 +1,8 @@
/*
- * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
@@ -437,8 +434,13 @@ prldap_connect( const char *hostlist, int defport, int timeout,
}
#ifdef _SOLARIS_SDK
- if ( NULL != hostname ) ldap_memfree(hostname);
- hostname = nsldapi_strdup(host);
+ if ( NULL != hostname ) {
+ ldap_memfree(hostname);
+ hostname = NULL;
+ }
+ if ( rc >= 0 ) {
+ hostname = nsldapi_strdup(host);
+ }
#endif /* _SOLARIS_SDK */
ldap_memfree( host );
}