plug leaks

This commit is contained in:
Howard Chu 2006-03-31 12:20:04 +00:00
parent 90c8a53db4
commit 0af1940f3f
9 changed files with 40 additions and 14 deletions

View File

@ -473,8 +473,7 @@ bdb_idl_cache_del_id(
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 );
}
}

View File

@ -1285,6 +1285,7 @@ monitor_back_initialize(
}
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 );
@ -1293,6 +1294,7 @@ monitor_back_initialize(
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 );
@ -1328,6 +1330,7 @@ monitor_back_initialize(
}
if ( oc->oc_oid == NULL ) {
ldap_objectclass_free(oc);
Debug( LDAP_DEBUG_ANY,
"objectclass \"%s\" has no OID\n" ,
moc[ i ].name, 0, 0 );
@ -1336,12 +1339,12 @@ monitor_back_initialize(
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 );

View File

@ -4080,6 +4080,11 @@ out:
}
ch_free( ca->argv );
if ( colst ) ch_free( colst );
while( dels ) {
deltail = dels->next;
ch_free( dels );
dels = deltail;
}
return rc;
}

View File

@ -488,7 +488,7 @@ init_config_attrs(ConfigTable *ct) {
}
}
code = slap_str2ad( at->at_names[0], &ct[i].ad, &err );
if ( freeit ) {
if ( freeit || code ) {
ldap_attributetype_free( at );
} else {
ldap_memfree( at );
@ -523,10 +523,14 @@ init_config_ocs( ConfigOCs *ocs ) {
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;
}

View File

@ -372,38 +372,44 @@ cr_add(
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

View File

@ -169,6 +169,7 @@ mr_add(
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;
}
}
@ -198,10 +199,12 @@ mr_add(
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);

View File

@ -100,13 +100,14 @@ parse_oidm(
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;
}
@ -116,6 +117,7 @@ usage: fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
"%s: line %d: "
"ObjectIdentifier \"%s\" previously defined \"%s\"",
fname, lineno, argv[1], oid );
SLAP_FREE( oid );
return 1;
}

View File

@ -1202,6 +1202,7 @@ slap_schema_load( void )
fprintf( stderr, "slap_schema_load: "
"AttributeType \"%s\": no OID\n",
ad_map[i].ssam_name );
ldap_attributetype_free( at );
return LDAP_OTHER;
}
@ -1317,18 +1318,20 @@ slap_schema_load( void )
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 **)

View File

@ -69,6 +69,7 @@ test_file( const char *fname, const char *ftype )
return -1;
}
fclose( fp );
unlink( fname );
break;
}