/*
+ * 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.
*
#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>
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 ) {
} 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 ) {
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_defhost != NULL )
- free( ld->ld_defhost );
+ if ( ld->ld_options.ldo_defbase != NULL )
+ free( ld->ld_options.ldo_defbase );
- free( (char *) ld );
+ 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 );