]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-libnet: Fix memory leak of lsa_RefDomainList and lsa_String onto libnet_ctx
authorAndrew Bartlett <abartlet@samba.org>
Fri, 31 Aug 2012 02:38:41 +0000 (12:38 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 31 Aug 2012 04:30:38 +0000 (14:30 +1000)
These are only needed for as long as the call, and should be children of the
private context.

This was found based on a log provided by Ricky Nance
<ricky.nance@weaubleau.k12.mo.us>.  Thanks Ricky!

Andrew Bartlett

source4/libnet/libnet_lookup.c

index 31ac6e4c10214ef6e5245c9feaded0fff0c1de1c..cf2d70c41df4ead401e0f5485ce127b64bf68298 100644 (file)
@@ -308,7 +308,7 @@ static bool prepare_lookup_params(struct libnet_context *ctx,
        s->sids.count = 0;
        s->sids.sids  = NULL;
        
-       s->names = talloc_array(ctx, struct lsa_String, single_name);
+       s->names = talloc_array(s, struct lsa_String, single_name);
        if (composite_nomem(s->names, c)) return false;
        s->names[0].string = s->name;
        
@@ -320,7 +320,7 @@ static bool prepare_lookup_params(struct libnet_context *ctx,
        s->lookup.in.count     = &s->count;
        s->lookup.out.count    = &s->count;
        s->lookup.out.sids     = &s->sids;
-       s->lookup.out.domains  = talloc_zero(ctx, struct lsa_RefDomainList *);
+       s->lookup.out.domains  = talloc_zero(s, struct lsa_RefDomainList *);
        if (composite_nomem(s->lookup.out.domains, c)) return false;
        
        return true;