From 61eec0734af3f2ce70bc2a78677cbd91ab457fcb Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 24 May 2003 00:46:52 +0000 Subject: [PATCH] Fix double-free'd rdn bug --- servers/slapd/back-bdb/cache.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index ac229fa2d9..8a6e1b3cba 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -262,6 +262,8 @@ bdb_entryinfo_add_internal( elru->bei_lruprev = NULL; elru->bei_state = 0; #ifdef BDB_HIER + ch_free(elru->bei_rdn.bv_val); + elru->bei_rdn.bv_val = NULL; elru->bei_modrdns = 0; #endif ei2 = elru; @@ -289,10 +291,10 @@ bdb_entryinfo_add_internal( addkid = 0; cache->c_cursize -= incr; #ifdef BDB_HIER - if ( ei->bei_rdn.bv_val ) { - ber_memfree_x( ei->bei_rdn.bv_val, NULL ); - ei->bei_rdn.bv_val = NULL; - } + /* It got freed above because its value was + * assigned to ei2. + */ + ei->bei_rdn.bv_val = NULL; #endif } else { LRU_ADD( cache, ei2 ); -- 2.39.5