[Samba] Possible memory leaks on lookup_sids()?

Jeremy Allison jra at samba.org
Sat Oct 27 01:01:53 GMT 2007


On Fri, Oct 26, 2007 at 09:40:18AM +0200, Volker Lendecke wrote:
> On Mon, Oct 22, 2007 at 06:28:57PM -0400, simo wrote:
> > Li, it seem indeed that we are not freeing the tmp_ctx at the end of the
> > function, but I need some time to read that code in detail to make sure
> > we are not returning some of that memory to the caller.
> 
> I think it is true. We need to free tmp_ctx before
> returning. At least this is what it was designed for.

Yes - all memory returned is talloced off the dom_infos
and name_infos variables as talloc contexts, which belong
to the incoming mem_ctx ctx. All memory on the
tmp_ctx can be thrown away at this point (although
it will still be freed when mem_ctx is freed).

Jeremy.


More information about the samba-technical mailing list