From: Howard Chu Date: Sat, 24 May 2003 00:46:52 +0000 (+0000) Subject: Fix double-free'd rdn bug X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~58 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=61eec0734af3f2ce70bc2a78677cbd91ab457fcb;p=openldap Fix double-free'd rdn bug --- 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 );