mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 08:39:37 -05:00
Add CSRIMALLOC support
This commit is contained in:
parent
1429fc36eb
commit
5b4e2498d9
1 changed files with 22 additions and 0 deletions
|
|
@ -28,6 +28,11 @@ int continuemode = 0;
|
|||
char *ldiffile = NULL;
|
||||
FILE *ldiffp = NULL;
|
||||
|
||||
#ifdef CSRIMALLOC
|
||||
char *leakfilename;
|
||||
FILE *leakfile;
|
||||
#endif
|
||||
|
||||
Backend *be = NULL;
|
||||
|
||||
static void
|
||||
|
|
@ -80,6 +85,15 @@ slap_tool_init(
|
|||
|
||||
progname = lutil_progname( name, argc, argv );
|
||||
|
||||
#ifdef CSRIMALLOC
|
||||
leakfilename = malloc( strlen( progname ) + sizeof(".leak") );
|
||||
sprintf( leakfilename, "%s.leak", progname );
|
||||
if( ( leakfile = fopen( leakfilename, "w" )) == NULL ) {
|
||||
leakfile = stderr;
|
||||
}
|
||||
free( leakfilename );
|
||||
#endif
|
||||
|
||||
switch( tool ) {
|
||||
case SLAPADD:
|
||||
options = "b:cd:f:l:n:stv";
|
||||
|
|
@ -212,6 +226,10 @@ slap_tool_init(
|
|||
be = &backends[dbnum];
|
||||
}
|
||||
|
||||
#ifdef CSRIMALLOC
|
||||
mal_leaktrace(1);
|
||||
#endif
|
||||
|
||||
slap_startup( be );
|
||||
}
|
||||
|
||||
|
|
@ -219,4 +237,8 @@ void slap_tool_destroy( void )
|
|||
{
|
||||
slap_shutdown( be );
|
||||
slap_destroy();
|
||||
|
||||
#ifdef CSRIMALLOC
|
||||
mal_dumpleaktrace( leakfile );
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue