From: Kurt Zeilenga Date: Mon, 18 Jan 1999 18:02:39 +0000 (+0000) Subject: Fix slapd crash (ITS#38)... onelevel_candidates() should attempt X-Git-Tag: OPENLDAP_REL_ENG_1_1_3~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62cfa79247ead9d0b5410e91324f92fb51420949;p=thirdparty%2Fopenldap.git Fix slapd crash (ITS#38)... onelevel_candidates() should attempt to return entry lock with e == NULL. --- diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 438397f441..15c0d3f6a7 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -359,7 +359,7 @@ onelevel_candidates( ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; - Entry *e; + Entry *e = NULL; Filter *f; char buf[20]; IDList *candidates; @@ -367,7 +367,7 @@ onelevel_candidates( Debug(LDAP_DEBUG_TRACE, "onelevel_candidates: base: \"%s\"\n", base, 0, 0); *err = LDAP_SUCCESS; - e = NULL; + /* get the base object with reader lock */ if ( base != NULL && *base != '\0' && (e = dn2entry_r( be, base, matched )) == NULL ) @@ -402,7 +402,9 @@ onelevel_candidates( filter_free( f ); /* free entry and reader lock */ - cache_return_entry_r( &li->li_cache, e ); + if( e != NULL ) { + cache_return_entry_r( &li->li_cache, e ); + } return( candidates ); } @@ -442,6 +444,8 @@ subtree_candidates( *err = LDAP_SUCCESS; f = NULL; if ( lookupbase ) { + e = NULL; + if ( base != NULL && *base != '\0' && (e = dn2entry_r( be, base, matched )) == NULL ) {