[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: FW: Memory Leak in ldap_int_initialize(void)

At 02:39 AM 2/3/00 +0900, Kim, SuYoung wrote:
>> 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";

Your fix is not valid.  Any attempt to set the global default
host would result in free being called with a pointer to a
string literal.

The appropriate solution is to implement an atexit() handler
to do whatever cleanup is needed upon exit().

Feel free to implement and submit a proper solution.