diff options
Diffstat (limited to 'ldap/servers/slapd/main.c')
-rw-r--r-- | ldap/servers/slapd/main.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 61ead86f..3a328cd8 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -225,7 +225,7 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn) char *log=NULL, *ptr=NULL; int rc=0; - log=strdup(name); + log=slapi_ch_strdup(name); if(strip_fn) { if((ptr=strrchr(log,'/'))==NULL) @@ -250,7 +250,7 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn) } PR_CloseDir( dir ); } - free(log); + slapi_ch_free_string(&log); } /* Changes the owner of the files in the logs and @@ -621,6 +621,12 @@ write_start_pid_file() } #endif /* WIN32 */ +#ifdef MEMPOOL_EXPERIMENTAL +void _free_wrapper(void *ptr) +{ + slapi_ch_free(&ptr); +} +#endif int main( int argc, char **argv) @@ -635,6 +641,19 @@ main( int argc, char **argv) _main(); #endif #endif +#ifdef MEMPOOL_EXPERIMENTAL + /* to use LDAP C SDK lber functions seemlessly with slapi_ch_malloc funcs, + * setting the slapi_ch_malloc funcs to lber option here. */ + { + struct ldap_memalloc_fns memalloc_fns; + + memalloc_fns.ldapmem_malloc = (LDAP_MALLOC_CALLBACK *)slapi_ch_malloc; + memalloc_fns.ldapmem_calloc = (LDAP_CALLOC_CALLBACK *)slapi_ch_calloc; + memalloc_fns.ldapmem_realloc = (LDAP_REALLOC_CALLBACK *)slapi_ch_realloc; + memalloc_fns.ldapmem_free = (LDAP_FREE_CALLBACK *)_free_wrapper; + ldap_set_option( 0x1, LDAP_OPT_MEMALLOC_FN_PTRS, &memalloc_fns ); + } +#endif /* * Initialize NSPR very early. NSPR supports implicit initialization, * but it is not bulletproof -- so it is better to be explicit. |