X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fcr.c;h=948f4ec0cda34e88a00aeca5d01188cf5d725f5d;hb=5c3a4e176e9539f58a1ac666ad370b4c204cd44c;hp=eb9178d7e7f90b55c0be1c0c35110385042b3ce0;hpb=119cbcaba43185e483b74b359e56fcf5d921404f;p=openldap diff --git a/servers/slapd/cr.c b/servers/slapd/cr.c index eb9178d7e7..948f4ec0cd 100644 --- a/servers/slapd/cr.c +++ b/servers/slapd/cr.c @@ -417,9 +417,10 @@ cr_unparse( BerVarray *res, ContentRule *start, ContentRule *end, int sys ) /* count the result size */ i = 0; - for ( cr=start; cr && cr!=end; cr=LDAP_STAILQ_NEXT(cr, scr_next)) { + for ( cr=start; cr; cr=LDAP_STAILQ_NEXT(cr, scr_next)) { if ( sys && !(cr->scr_flags & SLAP_CR_HARDCODE)) continue; i++; + if ( cr == end ) break; } if (!i) return; @@ -432,7 +433,7 @@ cr_unparse( BerVarray *res, ContentRule *start, ContentRule *end, int sys ) ibuf[0] = '\0'; } i = 0; - for ( cr=start; cr && cr!=end; cr=LDAP_STAILQ_NEXT(cr, scr_next)) { + for ( cr=start; cr; cr=LDAP_STAILQ_NEXT(cr, scr_next)) { if ( sys && !(cr->scr_flags & SLAP_CR_HARDCODE)) continue; if ( ldap_contentrule2bv( &cr->scr_crule, &bv ) == NULL ) { ber_bvarray_free( bva ); @@ -447,6 +448,7 @@ cr_unparse( BerVarray *res, ContentRule *start, ContentRule *end, int sys ) i++; bva[i].bv_val = NULL; ldap_memfree( bv.bv_val ); + if ( cr == end ) break; } *res = bva; }