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

RE: ldap_sasl_interactive_bind_s leaks? (ITS#2423)



> -----Original Message-----
> From: Igor Brezac [mailto:igor@ipass.net]

> On Sat, 5 Apr 2003, Howard Chu wrote:
> > > Anyway,
> > > ldap_sasl_interactive_bind_s() frees
> > > SASL_INTERACT prompt result, but I do not think it frees
> > > other prompt buffers.
> > > I looked throught sources for ldapsearch and slurpd, but I
> > > did not find ways to
> > > free the buffers allocated in _ldap_interact.

> > It appears that _ldap_interact doesn't need to malloc the result at all.
We
> > can fix this easily enough. However there appear to be more leaks in
Cyrus
>
> True.  I tried without malloc and it works fine.  However, the leak is
> still there.  There is something else wrong.

The code in ldap_int_sasl_bind() to free the prompts was hopeless because it
only examined the first prompts structure, but usually SASL gives an array of
prompts. It is too clumsy to try to manage this in libldap, especially given
the possibility of different libraries using different malloc()s, so I have
ripped out that code.

I have updated liblutil to manage results more thoroughly, and added a
lutil_sasl_freedefs() function to cleanup after the SASL bind completes.
Please use this new design as a model for your own code.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support