release entry, if required; release mapping resources as appropriate on exit

This commit is contained in:
Pierangelo Masarati 2005-11-03 13:34:43 +00:00
parent 11f6938162
commit e2b87791ac
4 changed files with 21 additions and 10 deletions

View File

@ -1043,6 +1043,7 @@ rwm_send_entry( Operation *op, SlapReply *rs )
goto fail;
}
flags &= ~REP_ENTRY_MUSTRELEASE;
flags |= ( REP_ENTRY_MODIFIABLE | REP_ENTRY_MUSTBEFREED );
}
@ -1075,11 +1076,9 @@ rwm_send_entry( Operation *op, SlapReply *rs )
* to return, and remap them accordingly */
(void)rwm_attrs( op, rs, &e->e_attrs, 1 );
#if 0
if ( rs->sr_operational_attrs ) {
(void)rwm_attrs( op, rs, &rs->sr_operational_attrs, 0 );
if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
be_entry_release_rw( op, rs->sr_entry, 0 );
}
#endif
rs->sr_entry = e;
rs->sr_flags = flags;
@ -1482,7 +1481,7 @@ rwm_db_destroy(
(struct ldaprwmap *)on->on_bi.bi_private;
#ifdef ENABLE_REWRITE
if (rwmap->rwm_rw) {
if ( rwmap->rwm_rw ) {
rewrite_info_delete( &rwmap->rwm_rw );
}
#else /* !ENABLE_REWRITE */
@ -1491,9 +1490,9 @@ rwm_db_destroy(
}
#endif /* !ENABLE_REWRITE */
avl_free( rwmap->rwm_oc.remap, NULL );
avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
avl_free( rwmap->rwm_at.remap, NULL );
avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_at.map, rwm_mapping_free );
ch_free( rwmap );

View File

@ -138,6 +138,8 @@ rwm_map_attrnames(
AttributeName **anp,
int remap );
extern void rwm_mapping_dst_free ( void *mapping );
extern void rwm_mapping_free ( void *mapping );
extern int rwm_map_config(

View File

@ -146,7 +146,7 @@ rwm_map_config(
if ( mapping[0].m_dst_oc == NULL ) {
fprintf( stderr, "%s: line %d: unable to mimic destination objectClass '%s'\n",
fname, lineno, dst );
return 1;
goto error_return;
}
#if 0
@ -186,7 +186,7 @@ rwm_map_config(
fprintf( stderr,
"%s: line %d: source attributeType '%s': %d (%s)\n",
fname, lineno, src, rc, text ? text : "null" );
return 1;
goto error_return;
}
}
@ -207,7 +207,7 @@ rwm_map_config(
fprintf( stderr,
"%s: line %d: destination attributeType '%s': %d (%s)\n",
fname, lineno, dst, rc, text ? text : "null" );
return 1;
goto error_return;
}
}
mapping[1].m_src_ad = mapping[0].m_dst_ad;

View File

@ -1198,6 +1198,16 @@ rwm_dnattr_result_rewrite(
return 0;
}
void
rwm_mapping_dst_free( void *v_mapping )
{
struct ldapmapping *mapping = v_mapping;
if ( BER_BVISEMPTY( &mapping[0].m_dst ) ) {
rwm_mapping_free( &mapping[ -1 ] );
}
}
void
rwm_mapping_free( void *v_mapping )
{