]> git.sur5r.net Git - openldap/commitdiff
Plug memory leaks
authorHallvard Furuseth <hallvard@openldap.org>
Sun, 4 Apr 1999 21:34:33 +0000 (21:34 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Sun, 4 Apr 1999 21:34:33 +0000 (21:34 +0000)
servers/slapd/back-ldbm/idl.c
servers/slapd/config.c

index dd4867ffe5a67d62477d92ea907a786ddb867779..ebe90f06d5c920d2dc41b85d58f54103183fa859 100644 (file)
@@ -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;
 }
 
index b02313b5cea80a278d19228788c011051459f7c5..153f9d21f464367f01fbc9587f76ed2437a9f779 100644 (file)
@@ -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;
                                        }
                                }