Mercurial > illumos > illumos-gate
changeset 10284:f12571ecd37e
6846156 memleak in prldap_connect()
author | Milan Jurik <Milan.Jurik@Sun.COM> |
---|---|
date | Sun, 09 Aug 2009 09:20:12 +0100 |
parents | 76ddfbe3b1a4 |
children | 8e0daec5f995 |
files | usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c Sat Aug 08 19:40:49 2009 -0700 +++ b/usr/src/lib/libldap5/sources/ldap/prldap/ldappr-io.c Sun Aug 09 09:20:12 2009 +0100 @@ -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 @@ } #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 ); }