[Samba] Possible memory leaks on lookup_sids()?

simo idra at samba.org
Mon Oct 22 22:28:57 GMT 2007


Moved to samba-technical

On Mon, 2007-10-22 at 21:26 +0000, Li, Ying (ESG) wrote:
> Seems that there are some memory leaks on the variables names[j], names
> and domain_name in passdb/lookup_sid.c:lookup_sids(). After transferring
> names[j] to name_infos in that nested for loop, probably need to free
> names[j] content. Before the end of the outside for loop, the variables
> domain_name and names need to be released too.
> 
> Could somebody look at the line 828-881 in lookup_sids() for 3.2.0pre1?
> Thanks.

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.
In any case, the memory is not completely leaked as it hangs on the
mem_ctx passed to lookup_sids(), as soon as the caller frees that
context all that memory is freed.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Senior Software Engineer at Red Hat Inc. <ssorce at redhat.com>



More information about the samba-technical mailing list