> void ldap_int_initialize( void ) > { > if ( gopts.ldo_valid == LDAP_INITIALIZED ) { > return; > } > > ldap_int_utils_init(); > > #ifdef HAVE_TLS > ldap_pvt_tls_init(); > #endif > > if ( ldap_int_tblsize == 0 ) > ldap_int_ip_init(); > > gopts.ldo_debug = 0; > > gopts.ldo_version = LDAP_VERSION2; > gopts.ldo_deref = LDAP_DEREF_NEVER; > gopts.ldo_timelimit = LDAP_NO_LIMIT; > gopts.ldo_sizelimit = LDAP_NO_LIMIT; > > gopts.ldo_tm_api = (struct timeval *)NULL; > gopts.ldo_tm_net = (struct timeval *)NULL; > > gopts.ldo_defhost = STRDUP("localhost"); <--- memory leak come from > this code. > gopts.ldo_defport = LDAP_PORT; > > gopts.ldo_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT; > > LDAP_BOOL_ZERO(&gopts); > > LDAP_BOOL_SET(&gopts, LDAP_BOOL_REFERRALS); > > #ifdef HAVE_TLS > gopts.ldo_tls_ctx = NULL; > #endif > > gopts.ldo_valid = LDAP_INITIALIZED; > > if( getenv("LDAPNOINIT") != NULL ) { > return; > } > > openldap_ldap_init_w_conf(LDAP_CONF_FILE); > openldap_ldap_init_w_userconf(LDAP_USERRC_FILE); > > { > char *altfile = getenv(LDAP_ENV_PREFIX "CONF"); > > if( altfile != NULL ) { > openldap_ldap_init_w_conf( altfile ); > } > } > > { > char *altfile = getenv(LDAP_ENV_PREFIX "RC"); > > if( altfile != NULL ) { > openldap_ldap_init_w_userconf( altfile ); > } > } > > openldap_ldap_init_w_env(NULL); > } > > > I am a Korean, so speak a little English. My system is Windows NT 4.0 > with SP5, Visual C++ 6.0 with SP3. > I compile a simple ldap program. and I have a memory leak. so I find > it! and change the code. it is very simple. > Just gopts.ldo_defhost = STRDUP("localhost"); => gopts.ldo_defhost = > "localhost"; > > Thanks for reading. > > > > >
<<attachment: winmail.dat>>