]> git.sur5r.net Git - openldap/commitdiff
More thorough backend_destroy. Added config_destroy. Destroy slap_listeners.
authorHoward Chu <hyc@openldap.org>
Sat, 15 Dec 2001 12:05:58 +0000 (12:05 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 15 Dec 2001 12:05:58 +0000 (12:05 +0000)
Plugged other small leaks.

servers/slapd/backend.c
servers/slapd/config.c
servers/slapd/daemon.c
servers/slapd/main.c
servers/slapd/sasl.c

index 1162fa5a9a160f9783eac5e97efb9a05dfc69c14..5398d8e21ddcb7389382859308fe15530bada5f3 100644 (file)
@@ -417,7 +417,13 @@ int backend_destroy(void)
                        backendDB[i].bd_info->bi_db_destroy(
                                &backendDB[i] );
                }
+               charray_free( backendDB[i].be_suffix );
+               ber_bvecfree( backendDB[i].be_nsuffix );
+               free( backendDB[i].be_root_dn );
+               free( backendDB[i].be_root_ndn );
+               free( backendDB[i].be_root_pw.bv_val );
        }
+       free( backendDB );
 
        /* destroy each backend type */
        for( i = 0; i < nBackendInfo; i++ ) {
index 45c6b36ee95c888610622b4630ff1539b61ce1c7..1cbb00fcf3e8753d21436c33cb8e04f704ea8172 100644 (file)
@@ -919,11 +919,12 @@ read_config( const char *fname )
 #endif
 
                        } else {
-                               char *dn = ch_strdup( cargv[1] );
+                               char *dn;
 
                                if ( load_ucdata( NULL ) < 0 ) {
                                        return( 1 );
                                }
+                               dn = ch_strdup( cargv[1] );
                                if( dn_validate( dn ) == NULL ) {
 #ifdef NEW_LOGGING
                                        LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
@@ -934,7 +935,7 @@ read_config( const char *fname )
                                                "suffix DN invalid \"%s\"\n",
                                        fname, lineno, cargv[1] );
 #endif
-
+                                       free( dn );
                                        return 1;
 
                                } else if( *dn == '\0' && default_search_nbase != NULL ) {
@@ -966,6 +967,7 @@ read_config( const char *fname )
                                                "unable to normalize suffix "
                                                "\"%s\"\n", dn, NULL, NULL );
 #endif
+                                       free( dn );
                                        return 1;
                                }
 #endif /* USE_LDAP_DN_PARSING */
@@ -2370,3 +2372,14 @@ load_ucdata( char *path )
        loaded = 1;
        return( 1 );
 }
+
+void
+config_destroy( )
+{
+       ucdata_unload( UCDATA_ALL );
+       free( line );
+       if ( slapd_args_file )
+               free ( slapd_args_file );
+       if ( slapd_pid_file )
+               free ( slapd_pid_file );
+}
index 3e71735c11eae539dda2c9a2db78983e7d172298..4b5ab5f973e560e5502268f5b5b66eb1a55a7b71 100644 (file)
@@ -1675,9 +1675,15 @@ slapd_daemon_task(
                        }
 #endif /* LDAP_PF_LOCAL */
                        slapd_close( slap_listeners[l]->sl_sd );
-                       break;
                }
+               if ( slap_listeners[l]->sl_url )
+                       free ( slap_listeners[l]->sl_url );
+               if ( slap_listeners[l]->sl_name )
+                       free ( slap_listeners[l]->sl_name );
+               free ( slap_listeners[l] );
        }
+       free ( slap_listeners );
+       slap_listeners = NULL;
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
index b71bb99d21126a6b28afe0988251e9b5773a8212..c46d0b2b6de9b7658ede71fadd24f15caa63057b 100644 (file)
@@ -307,9 +307,9 @@ int main( int argc, char **argv )
 
        if( serverName == NULL ) {
                if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) {
-                       serverName = ch_strdup( argv[0] );
+                       serverName = argv[0];
                } else {
-                       serverName = ch_strdup( serverName + 1 );
+                       serverName = serverName + 1;
                }
        }
 
@@ -556,6 +556,8 @@ stop:
        ldap_pvt_tls_destroy();
 #endif
 
+       config_destroy();
+
 #ifdef CSRIMALLOC
        mal_dumpleaktrace( leakfile );
 #endif
index 7a3b21921f457295f9efa15f09e121b9f350caae..ea3dc20aa81cdd15e3d3a109e6b2a06886bd988f 100644 (file)
@@ -425,6 +425,9 @@ int slap_sasl_destroy( void )
 #ifdef HAVE_CYRUS_SASL
        sasl_done();
 #endif
+       free( global_host );
+       global_host = NULL;
+
        return 0;
 }