diff options
author | Milan Jurik <Milan.Jurik@Sun.COM> | 2009-08-09 09:20:12 +0100 |
---|---|---|
committer | Milan Jurik <Milan.Jurik@Sun.COM> | 2009-08-09 09:20:12 +0100 |
commit | e944850b16b5f1c0446b0e09400846b63b1ee8a3 (patch) | |
tree | fad6e2028b8a841681f7726c6da2a87b7fc45ea5 /usr/src/lib/libldap5 | |
parent | 93a61d92901e899ac53171c1afb6286ed37a0670 (diff) | |
download | illumos-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.c | 14 |
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 ); } |