From: Kurt Zeilenga Date: Mon, 18 Jan 1999 17:41:12 +0000 (+0000) Subject: Protect return of the locked entry. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~754 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8009e591ce2cd0516f155cfd26edb2e4690b3fa4;p=openldap Protect return of the locked entry. Note: we probably can replace the dn2entry_r with dn2id as only the id is needed unless we're holding the lock for filtercandidates or something --- diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index b1f7d33ef3..8f8430dedf 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -358,7 +358,7 @@ onelevel_candidates( ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; - Entry *e; + Entry *e = NULL; Filter *f; char buf[20]; IDList *candidates; @@ -366,7 +366,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 ) @@ -401,7 +401,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 ); } @@ -441,6 +443,8 @@ subtree_candidates( *err = LDAP_SUCCESS; f = NULL; if ( lookupbase ) { + e = NULL; + if ( base != NULL && *base != '\0' && (e = dn2entry_r( be, base, matched )) == NULL ) {