Winbindd Memory Leak

Esh, Andrew AEsh at tricord.com
Wed Oct 3 16:33:03 GMT 2001


I'm looking at get_sam_user_entries, in winbindd_user.c, where the names are
being unpacked and transferred into the reply. The
ent->domain->sam_dom_handle->mem_ctx (ent is passed in) is the memory
context that appears to be in use within the libsmb functions being called
further down the stack.

The problem I have now is I have to trace all the code from there on down to
find out what is being allocated in that talloc context. Otherwise, I could
talloc_destroy it in get_sam_user_entries, and be destroying other
allocations that are still in use. I know I can't free those names any
earlier than get_sam_user_entries, because that function is where they are
unpacked. There may be a later opportunity, but I haven't found that yet
either.

-----Original Message-----
From: Tim Potter [mailto:tpot at samba.org]
Sent: Wednesday, October 03, 2001 6:06 PM
To: Esh, Andrew
Cc: Samba-Technical (E-mail)
Subject: Re: Winbindd Memory Leak


Esh, Andrew writes:

> I reported a bad memory leak in winbindd some time in the recent past.
I've
> made some progress finding it, so I thought I'd report. To catch up: I
took
> a snapshot of SAMBA_2_2 from your CVS at date "2001-10-01 1600GMT",
compiled
> it for winbindd, and found that it leaks memory when processing user
lists.

[...]

> The size of the leak varies from 8 to 12 bytes, but the stack is always
> identical. The call to talloc implies that all of this leaked memory could
> be freed at one point by calling talloc_destroy. My problem is, I don't
know
> (yet) where to do that. The obvious place is somewhere in the stack listed
> above, but I don't quite see where yet.

There is a call to lp_talloc_free() in the winbindd main loop
which should free memory as it is going along.  This only frees
memory from the global tdb used for parameter strings.  I suspect
there is another TALLOC_CTX that is being used, probably in the
rpc code, that is not being freed.  I'm taking a look at it now.


Tim.
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the samba-technical mailing list