From 2b32e6afd70ff1e3e264969a669ea952deb3f611 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Sun, 4 Apr 1999 21:34:33 +0000 Subject: [PATCH] Plug memory leaks --- servers/slapd/back-ldbm/idl.c | 14 +++++++++----- servers/slapd/config.c | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index dd4867ffe5..ebe90f06d5 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -371,9 +371,7 @@ idl_insert_key( idl_free( idl ); idl = idl_allids( be ); rc = idl_store( be, db, key, idl ); - idl_free( idl ); - - return( rc ); + break; } idl_split_block( idl, id, &tmp, &tmp2 ); @@ -442,6 +440,7 @@ idl_insert_key( Debug( LDAP_DEBUG_ANY, "nonexistent continuation block (%s)\n", k2.dptr, 0, 0 ); free( kstr ); + idl_free( idl ); return( -1 ); } @@ -510,10 +509,9 @@ idl_insert_key( return( 0 ); case 3: /* split the original block */ - idl_free( tmp2 ); break; } - + idl_free( tmp2 ); } /* @@ -703,10 +701,12 @@ idl_delete_key ( idl_store( be, db, key, idl ); } + idl_free( idl ); return 0; } /* We didn't find the ID. Hmmm... */ } + idl_free( idl ); return -1; } @@ -759,12 +759,16 @@ idl_delete_key ( else idl_store( be, db, key, idl ); } + idl_free( tmp ); free( kstr ); + idl_free( idl ); return 0; } } + idl_free( tmp ); } free( kstr ); + idl_free( idl ); return -1; } diff --git a/servers/slapd/config.c b/servers/slapd/config.c index b02313b5ce..153f9d21f4 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -181,6 +181,7 @@ read_config( char *fname ) char *dn = ch_strdup( cargv[1] ); (void) dn_normalize_case( dn ); charray_add( &be->be_suffix, dn ); + free( dn ); } /* set database suffixAlias */ @@ -421,7 +422,7 @@ read_config( char *fname ) if ( strncasecmp( cargv[i], "host=", 5 ) == 0 ) { charray_add( &be->be_replica, - ch_strdup( cargv[i] + 5 ) ); + cargv[i] + 5 ); break; } } -- 2.39.5