]> git.sur5r.net Git - openldap/commitdiff
Fix slapd crash (ITS#38)... onelevel_candidates() should attempt
authorKurt Zeilenga <kurt@openldap.org>
Mon, 18 Jan 1999 18:02:39 +0000 (18:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 18 Jan 1999 18:02:39 +0000 (18:02 +0000)
to return entry lock with e == NULL.

servers/slapd/back-ldbm/search.c

index 438397f441d8dfb5dd3095036c39c350842bdd02..15c0d3f6a701648340fa5b92973ba66e69e8ff59 100644 (file)
@@ -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 )
                {