IDL_LRU_DELETE( bdb, cache_entry );
ldap_pvt_thread_mutex_unlock( &bdb->bi_idl_tree_lrulock );
free( cache_entry->kstr.bv_val );
- if ( cache_entry->idl )
- free( cache_entry->idl );
+ free( cache_entry->idl );
free( cache_entry );
}
}
}
if ( at->at_oid == NULL ) {
+ ldap_attributetype_free(at);
Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
"null OID for attributeType \"%s\"\n",
mat[ i ].name, 0, 0 );
code = at_add(at, 0, NULL, &err);
if ( code ) {
+ ldap_attributetype_free(at);
Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
"%s in attributeType \"%s\"\n",
scherr2str(code), mat[ i ].name, 0 );
}
if ( oc->oc_oid == NULL ) {
+ ldap_objectclass_free(oc);
Debug( LDAP_DEBUG_ANY,
"objectclass \"%s\" has no OID\n" ,
moc[ i ].name, 0, 0 );
code = oc_add(oc, 0, NULL, &err);
if ( code ) {
+ ldap_objectclass_free(oc);
Debug( LDAP_DEBUG_ANY,
"objectclass \"%s\": %s \"%s\"\n" ,
moc[ i ].name, scherr2str(code), err );
return -1;
}
-
ldap_memfree(oc);
Oc = oc_find( moc[ i ].name );
}
ch_free( ca->argv );
if ( colst ) ch_free( colst );
+ while( dels ) {
+ deltail = dels->next;
+ ch_free( dels );
+ dels = deltail;
+ }
return rc;
}
}
}
code = slap_str2ad( at->at_names[0], &ct[i].ad, &err );
- if ( freeit ) {
+ if ( freeit || code ) {
ldap_attributetype_free( at );
} else {
ldap_memfree( at );
if ( code && code != SLAP_SCHERR_CLASS_DUP ) {
fprintf( stderr, "init_config_ocs: objectclass \"%s\": %s, %s\n",
ocs[i].co_def, scherr2str(code), err );
+ ldap_objectclass_free(oc);
return code;
}
ocs[i].co_oc = oc_find(oc->oc_names[0]);
- ldap_memfree(oc);
+ if ( code )
+ ldap_objectclass_free(oc);
+ else
+ ldap_memfree(oc);
}
return 0;
}
scr->scr_sclass = oc_find(cr->cr_oid);
if ( !scr->scr_sclass ) {
*err = cr->cr_oid;
- return SLAP_SCHERR_CLASS_NOT_FOUND;
+ code = SLAP_SCHERR_CLASS_NOT_FOUND;
+ goto fail;
}
/* check object class usage */
if( scr->scr_sclass->soc_kind != LDAP_SCHEMA_STRUCTURAL )
{
*err = cr->cr_oid;
- return SLAP_SCHERR_CR_BAD_STRUCT;
+ code = SLAP_SCHERR_CR_BAD_STRUCT;
+ goto fail;
}
if( scr->scr_sclass->soc_flags & SLAP_OC_OPERATIONAL ) op++;
code = cr_add_auxiliaries( scr, &op, err );
- if ( code != 0 ) return code;
+ if ( code != 0 ) goto fail;
code = cr_create_required( scr, &op, err );
- if ( code != 0 ) return code;
+ if ( code != 0 ) goto fail;
code = cr_create_allowed( scr, &op, err );
- if ( code != 0 ) return code;
+ if ( code != 0 ) goto fail;
code = cr_create_precluded( scr, &op, err );
- if ( code != 0 ) return code;
+ if ( code != 0 ) goto fail;
if( user && op ) {
- return SLAP_SCHERR_CR_BAD_AUX;
+ code = SLAP_SCHERR_CR_BAD_AUX;
+ goto fail;
}
code = cr_insert(scr,err);
if ( code == 0 && rscr )
*rscr = scr;
return code;
+fail:
+ ch_free( scr );
+ return code;
}
void
for( i=0; def->mrd_compat_syntaxes[i]; i++ ) {
compat_syn[i] = syn_find( def->mrd_compat_syntaxes[i] );
if( compat_syn[i] == NULL ) {
+ ch_free( compat_syn );
return SLAP_SCHERR_SYN_NOT_FOUND;
}
}
smr->smr_syntax = syn;
} else {
*err = smr->smr_syntax_oid;
+ ch_free( smr );
return SLAP_SCHERR_SYN_NOT_FOUND;
}
} else {
*err = "";
+ ch_free( smr );
return SLAP_SCHERR_MR_INCOMPLETE;
}
code = mr_insert(smr,err);
OidMacro **rom)
{
char *oid;
- OidMacro *om;
+ OidMacro *om = NULL;
struct berval bv;
if (argc != 3) {
fprintf( stderr, "%s: line %d: too many arguments\n",
fname, lineno );
usage: fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
+ if (om) SLAP_FREE( om );
return 1;
}
"%s: line %d: "
"ObjectIdentifier \"%s\" previously defined \"%s\"",
fname, lineno, argv[1], oid );
+ SLAP_FREE( oid );
return 1;
}
fprintf( stderr, "slap_schema_load: "
"AttributeType \"%s\": no OID\n",
ad_map[i].ssam_name );
+ ldap_attributetype_free( at );
return LDAP_OTHER;
}
fprintf( stderr, "slap_schema_load: ObjectClass "
"\"%s\": no OID\n",
oc_map[i].ssom_name );
+ ldap_objectclass_free( oc );
return LDAP_OTHER;
}
code = oc_add(oc,0,NULL,&err);
if ( code ) {
+ ldap_objectclass_free( oc );
fprintf( stderr, "slap_schema_load: ObjectClass "
"\"%s\": %s: \"%s\"\n",
oc_map[i].ssom_name, scherr2str(code), err);
return code;
}
-
ldap_memfree(oc);
+
}
{
ObjectClass ** ocp = (ObjectClass **)
return -1;
}
+ fclose( fp );
unlink( fname );
break;
}