From: Luke Howard Date: Tue, 21 Jan 2003 05:56:46 +0000 (+0000) Subject: fix SLAPI_MODIFY_MODS pointer error X-Git-Tag: NO_SLAP_OP_BLOCKS~575 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8ab0c4d40130f916feb5a1566e757be6de7deff0;p=openldap fix SLAPI_MODIFY_MODS pointer error --- diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index f388f2e374..f6dbac13fe 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -809,6 +809,7 @@ static LDAPMod **Modifications2LDAPMods(Modifications **pmodlist) sizeof(struct berval *) ); for( j = 0; ml->sml_bvalues[j].bv_val != NULL; j++ ) { /* Take ownership of original values. */ + modp->mod_bvalues[j] = (struct berval *)ch_malloc( sizeof(struct berval) ); modp->mod_bvalues[j]->bv_len = ml->sml_bvalues[j].bv_len; modp->mod_bvalues[j]->bv_val = ml->sml_bvalues[j].bv_val; ml->sml_bvalues[j].bv_len = 0; @@ -896,7 +897,7 @@ static Modifications *LDAPMods2Modifications (LDAPMod **mods) */ static void FreeLDAPMods (LDAPMod **mods) { - int i; + int i, j; if (mods == NULL) return; @@ -907,6 +908,9 @@ static void FreeLDAPMods (LDAPMod **mods) * Modification list. Do free the containing array. */ if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) { + for ( j = 0; mods[i]->mod_bvalues[j] != NULL; j++ ) { + ch_free( mods[i]->mod_bvalues[j] ); + } ch_free( mods[i]->mod_bvalues ); } else { ch_free( mods[i]->mod_values );