From 19ddf0d63d3a48731fbfb73f85f396d269d2e182 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 16 Mar 2003 19:09:07 +0000 Subject: [PATCH] SLAP_NVALUES: still chasing an extranous free... this just saves an unneccessary malloc. (Actually, we should likely use local filter structure to read things into and then malloc/copy once we're sure there are no errors.) --- servers/slapd/filter.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index a871b2549f..7b10893155 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -354,6 +354,8 @@ get_substring_filter( struct berval value; char *last; struct berval bv; + AttributeDescription *ad; + *text = "error decoding filter"; #ifdef NEW_LOGGING @@ -366,18 +368,18 @@ get_substring_filter( return SLAPD_DISCONNECT; } - f->f_sub = ch_calloc( 1, sizeof(SubstringsAssertion) ); - f->f_sub_desc = NULL; - rc = slap_bv2ad( &bv, &f->f_sub_desc, text ); + ad = NULL; + rc = slap_bv2ad( &bv, &ad, text ); if( rc != LDAP_SUCCESS ) { text = NULL; - ch_free( f->f_sub ); f->f_choice = SLAPD_FILTER_COMPUTED; f->f_result = SLAPD_COMPARE_UNDEFINED; return LDAP_SUCCESS; } + f->f_sub = ch_calloc( 1, sizeof(SubstringsAssertion) ); + f->f_sub_desc = ad; f->f_sub_initial.bv_val = NULL; f->f_sub_any = NULL; f->f_sub_final.bv_val = NULL; @@ -450,7 +452,6 @@ get_substring_filter( #endif value = bv; - rc = LDAP_PROTOCOL_ERROR; switch ( tag ) { @@ -531,6 +532,7 @@ return_error: ber_bvarray_free( f->f_sub_any ); free( f->f_sub_final.bv_val ); ch_free( f->f_sub ); + f->f_sub = NULL; return rc; } } -- 2.39.5