From 82998790bb33dd543d13ebc50bc57ff2fbd66d1f Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 6 Oct 2005 19:11:13 +0000 Subject: [PATCH] Cleanup --- servers/slapd/ad.c | 6 ++---- servers/slapd/ldapsync.c | 3 ++- servers/slapd/syncrepl.c | 6 ++---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/servers/slapd/ad.c b/servers/slapd/ad.c index 48b4b27219..d351c5c49d 100644 --- a/servers/slapd/ad.c +++ b/servers/slapd/ad.c @@ -1029,9 +1029,8 @@ anlist2attrs( AttributeName * anlist ) i = 0; while ( attrs && attrs[i] ) { if ( *attrs[i] == '@' ) { + ch_free( attrs[i] ); for ( j = i; attrs[j]; j++ ) { - if ( j == i ) - ch_free( attrs[i] ); attrs[j] = attrs[j+1]; } } else { @@ -1043,9 +1042,8 @@ anlist2attrs( AttributeName * anlist ) j = i + 1; while ( attrs && attrs[j] ) { if ( !strcmp( attrs[i], attrs[j] )) { + ch_free( attrs[j] ); for ( k = j; attrs && attrs[k]; k++ ) { - if ( k == j ) - ch_free( attrs[j] ); attrs[k] = attrs[k+1]; } } else { diff --git a/servers/slapd/ldapsync.c b/servers/slapd/ldapsync.c index 9d335860df..72022c24fa 100644 --- a/servers/slapd/ldapsync.c +++ b/servers/slapd/ldapsync.c @@ -55,7 +55,8 @@ slap_compose_sync_cookie( "csn=%s,rid=%03d", csn->bv_val, rid ); } } - ber_str2bv( cookiestr, strlen(cookiestr), 1, cookie ); + ber_str2bv_x( cookiestr, strlen(cookiestr), 1, cookie, + op ? op->o_tmpmemctx : NULL ); } void diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 2a4220be9a..f812d5d4aa 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -231,9 +231,8 @@ init_syncrepl(syncinfo_t *si) j = 0; while ( exattrs[j] != NULL ) { if ( !strcmp( exattrs[j], sync_descs[i]->ad_cname.bv_val )) { + ch_free( exattrs[j] ); for ( k = j; exattrs[k] != NULL; k++ ) { - if ( k == j ) - ch_free( exattrs[k] ); exattrs[k] = exattrs[k+1]; } } else { @@ -250,9 +249,8 @@ init_syncrepl(syncinfo_t *si) while ( oc->soc_required[k] ) { if ( !strcmp( exattrs[i], oc->soc_required[k]->sat_cname.bv_val )) { + ch_free( exattrs[i] ); for ( l = i; exattrs[l]; l++ ) { - if ( l == i ) - ch_free( exattrs[i] ); exattrs[l] = exattrs[l+1]; } } else { -- 2.39.5