]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/unbind.c
Cast char* argument to hh_to_c() to Byte*
[openldap] / libraries / libldap / unbind.c
index d641ec3f9c7a5c4be0cabfa9a28e00a66b696e68..7f17a1bb7363c24306d15a0f2caf251fcd59f363 100644 (file)
@@ -1,4 +1,8 @@
 /*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*  Portions
  *  Copyright (c) 1990 Regents of the University of Michigan.
  *  All rights reserved.
  *
@@ -7,10 +11,6 @@
 
 #include "portable.h"
 
-#ifndef lint 
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -39,7 +39,7 @@ ldap_ld_free( LDAP *ld, int close )
        LDAPRequest     *lr, *nextlr;
 #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
-       if ( ld->ld_sb.sb_naddr == 0 ) {
+       if ( ld->ld_cldapnaddr == 0 ) {
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
                /* free LDAP structure and outstanding requests/responses */
                for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) {
@@ -60,11 +60,10 @@ ldap_ld_free( LDAP *ld, int close )
        } else {
                int     i;
 
-               for ( i = 0; i < ld->ld_sb.sb_naddr; ++i ) {
-                       free( ld->ld_sb.sb_addrs[ i ] );
+               for ( i = 0; i < ld->ld_cldapnaddr; ++i ) {
+                       free( ld->ld_cldapaddrs[ i ] );
                }
-               free( ld->ld_sb.sb_addrs );
-               free( ld->ld_sb.sb_fromaddr );
+               free( ld->ld_cldapaddrs );
        }
 
        for ( lm = ld->ld_responses; lm != NULL; lm = next ) {
@@ -86,16 +85,14 @@ ldap_ld_free( LDAP *ld, int close )
                free( ld->ld_ufnprefix );
        if ( ld->ld_filtd != NULL )
                ldap_getfilter_free( ld->ld_filtd );
-#ifndef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
-       if ( ld->ld_sb.sb_ber.ber_buf != NULL )
-               free( ld->ld_sb.sb_ber.ber_buf );
-#endif /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
        if ( ld->ld_abandoned != NULL )
                free( ld->ld_abandoned );
 
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        if ( ld->ld_selectinfo != NULL )
                ldap_free_select_info( ld->ld_selectinfo );
+#else
+       ber_clear( &(ld->ld_ber), 1 );
 #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
        if ( ld->ld_options.ldo_defbase != NULL )
@@ -104,8 +101,10 @@ ldap_ld_free( LDAP *ld, int close )
        if ( ld->ld_options.ldo_defhost != NULL )
                free( ld->ld_options.ldo_defhost );
 
+       lber_pvt_sb_destroy( &(ld->ld_sb) );   
+   
        free( (char *) ld );
-
+   
        WSACleanup();
 
        return( err );