From 8d80e3ab906d6e3855a8366ed1feeabeddc96ca2 Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Wed, 7 Jun 2017 20:15:13 +0200 Subject: [PATCH] Ticket 49285 - memory leak when resurrecting tombstone --- ldap/servers/slapd/back-ldbm/ldbm_add.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c index cd30cd6..20d2fe4 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_add.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c @@ -219,6 +219,7 @@ ldbm_back_add( Slapi_PBlock *pb ) originalentry = tmpentry; tmpentry = NULL; /* Adding the resetted addingentry to the cache. */ + if (cache_add_tentative(&inst->inst_cache, addingentry, NULL) < 0) { slapi_log_err(SLAPI_LOG_CACHE, "ldbm_back_add", "cache_add_tentative concurrency detected: %s\n", slapi_entry_get_dn_const(addingentry->ep_entry)); @@ -843,6 +844,11 @@ ldbm_back_add( Slapi_PBlock *pb ) add_update_entry_operational_attributes(addingentry, pid); } + if (is_resurect_operation && tombstoneentry && cache_is_in_cache(&inst->inst_cache, tombstoneentry)) { + /* we need to remove the tombstone from the cacehr otherwise we have two dns with the same id */ + cache_unlock_entry(&inst->inst_cache, tombstoneentry); + CACHE_RETURN(&inst->inst_cache, &tombstoneentry); + } /* Tentatively add the entry to the cache. We do this after adding any * operational attributes to ensure that the cache is sized correctly. */ if ( cache_add_tentative( &inst->inst_cache, addingentry, NULL ) < 0 ) -- 2.5.5