mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-02 03:49:34 -05:00
Fix memory leak of Mod.sml_type
This commit is contained in:
parent
a18e437356
commit
ee98e6938c
3 changed files with 13 additions and 10 deletions
|
|
@ -143,15 +143,12 @@ do_add( Connection *conn, Operation *op )
|
||||||
free( tmp.sml_type.bv_val );
|
free( tmp.sml_type.bv_val );
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
mod = (Modifications *) ch_malloc( sizeof(Modifications)
|
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
|
||||||
+ tmp.sml_type.bv_len + 1);
|
|
||||||
|
|
||||||
mod->sml_op = LDAP_MOD_ADD;
|
mod->sml_op = LDAP_MOD_ADD;
|
||||||
mod->sml_next = NULL;
|
mod->sml_next = NULL;
|
||||||
mod->sml_desc = NULL;
|
mod->sml_desc = NULL;
|
||||||
mod->sml_type.bv_val = (char *)(mod+1);
|
mod->sml_type = tmp.sml_type;
|
||||||
strcpy(mod->sml_type.bv_val, tmp.sml_type.bv_val);
|
|
||||||
mod->sml_type.bv_len = tmp.sml_type.bv_len;
|
|
||||||
mod->sml_bvalues = tmp.sml_bvalues;
|
mod->sml_bvalues = tmp.sml_bvalues;
|
||||||
|
|
||||||
*modtail = mod;
|
*modtail = mod;
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,8 @@ do_modify(
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod = (Modifications *) ch_malloc( sizeof(Modifications)
|
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
|
||||||
+ tmp.sml_type.bv_len + 1);
|
mod->sml_type = tmp.sml_type;
|
||||||
mod->sml_type.bv_val = (char *)(mod+1);
|
|
||||||
strcpy(mod->sml_type.bv_val, tmp.sml_type.bv_val);
|
|
||||||
mod->sml_type.bv_len = tmp.sml_type.bv_len;
|
|
||||||
mod->sml_bvalues = tmp.sml_bvalues;
|
mod->sml_bvalues = tmp.sml_bvalues;
|
||||||
mod->sml_desc = NULL;
|
mod->sml_desc = NULL;
|
||||||
*modtail = mod;
|
*modtail = mod;
|
||||||
|
|
@ -595,6 +592,7 @@ int slap_mods_opattrs(
|
||||||
if ( tmpval.bv_len ) {
|
if ( tmpval.bv_len ) {
|
||||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||||
mod->sml_op = mop;
|
mod->sml_op = mop;
|
||||||
|
mod->sml_type.bv_val = NULL;
|
||||||
mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
|
mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
|
||||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||||
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
|
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
|
||||||
|
|
@ -609,6 +607,7 @@ int slap_mods_opattrs(
|
||||||
|
|
||||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||||
mod->sml_op = mop;
|
mod->sml_op = mop;
|
||||||
|
mod->sml_type.bv_val = NULL;
|
||||||
mod->sml_desc = slap_schema.si_ad_entryUUID;
|
mod->sml_desc = slap_schema.si_ad_entryUUID;
|
||||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||||
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
|
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
|
||||||
|
|
@ -619,6 +618,7 @@ int slap_mods_opattrs(
|
||||||
|
|
||||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||||
mod->sml_op = mop;
|
mod->sml_op = mop;
|
||||||
|
mod->sml_type.bv_val = NULL;
|
||||||
mod->sml_desc = slap_schema.si_ad_creatorsName;
|
mod->sml_desc = slap_schema.si_ad_creatorsName;
|
||||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||||
ber_dupbv( &mod->sml_bvalues[0], &name );
|
ber_dupbv( &mod->sml_bvalues[0], &name );
|
||||||
|
|
@ -629,6 +629,7 @@ int slap_mods_opattrs(
|
||||||
|
|
||||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||||
mod->sml_op = mop;
|
mod->sml_op = mop;
|
||||||
|
mod->sml_type.bv_val = NULL;
|
||||||
mod->sml_desc = slap_schema.si_ad_createTimestamp;
|
mod->sml_desc = slap_schema.si_ad_createTimestamp;
|
||||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||||
ber_dupbv( &mod->sml_bvalues[0], ×tamp );
|
ber_dupbv( &mod->sml_bvalues[0], ×tamp );
|
||||||
|
|
@ -640,6 +641,7 @@ int slap_mods_opattrs(
|
||||||
|
|
||||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||||
mod->sml_op = mop;
|
mod->sml_op = mop;
|
||||||
|
mod->sml_type.bv_val = NULL;
|
||||||
mod->sml_desc = slap_schema.si_ad_entryCSN;
|
mod->sml_desc = slap_schema.si_ad_entryCSN;
|
||||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||||
ber_dupbv( &mod->sml_bvalues[0], &csn );
|
ber_dupbv( &mod->sml_bvalues[0], &csn );
|
||||||
|
|
@ -650,6 +652,7 @@ int slap_mods_opattrs(
|
||||||
|
|
||||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||||
mod->sml_op = mop;
|
mod->sml_op = mop;
|
||||||
|
mod->sml_type.bv_val = NULL;
|
||||||
mod->sml_desc = slap_schema.si_ad_modifiersName;
|
mod->sml_desc = slap_schema.si_ad_modifiersName;
|
||||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||||
ber_dupbv( &mod->sml_bvalues[0], &name );
|
ber_dupbv( &mod->sml_bvalues[0], &name );
|
||||||
|
|
@ -660,6 +663,7 @@ int slap_mods_opattrs(
|
||||||
|
|
||||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||||
mod->sml_op = mop;
|
mod->sml_op = mop;
|
||||||
|
mod->sml_type.bv_val = NULL;
|
||||||
mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
|
mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
|
||||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||||
ber_dupbv( &mod->sml_bvalues[0], ×tamp );
|
ber_dupbv( &mod->sml_bvalues[0], ×tamp );
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ slap_mod_free(
|
||||||
int freeit
|
int freeit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if ( mod->sm_type.bv_val)
|
||||||
|
free( mod->sm_type.bv_val );
|
||||||
if ( mod->sm_bvalues != NULL )
|
if ( mod->sm_bvalues != NULL )
|
||||||
bvarray_free( mod->sm_bvalues );
|
bvarray_free( mod->sm_bvalues );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue