From a875d7df182af52e6124d370dfb29c697f071555 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 27 Sep 2003 07:52:20 +0000 Subject: [PATCH] plug modrdn memleaks --- servers/slapd/back-ldbm/modify.c | 1 + servers/slapd/back-ldbm/modrdn.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 290f29c02f..5679f2dadc 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -153,6 +153,7 @@ int ldbm_modify_internal( rc = modify_add_values( e, mod, get_permissiveModify( op ), text, textbuf, textlen ); + mod->sm_op = SLAP_MOD_SOFTADD; if ( rc == LDAP_TYPE_OR_VALUE_EXISTS ) { rc = LDAP_SUCCESS; } diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 4a41506151..99440e9d45 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -655,10 +655,16 @@ return_results: if ( mod != NULL ) { Modifications *tmp; for (; mod; mod = tmp ) { + /* slap_modrdn2mods does things one way, + * slap_mods_opattrs does it differently + */ + if ( mod->sml_op != SLAP_MOD_SOFTADD && + mod->sml_op != LDAP_MOD_DELETE ) break; if ( mod->sml_nvalues ) free( mod->sml_nvalues[0].bv_val ); tmp = mod->sml_next; free( mod ); } + slap_mods_free( mod ); } /* LDAP v3 Support */ -- 2.39.5