libcli: Fix a memleak
authorVolker Lendecke <vl@samba.org>
Mon, 26 May 2014 20:48:05 +0000 (20:48 +0000)
committerVolker Lendecke <vl@samba.org>
Tue, 27 May 2014 10:54:55 +0000 (12:54 +0200)
struct security_ace has a struct dom_sid, not a pointer to it. So we don't have
to talloc it first and then not free it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue May 27 12:54:55 CEST 2014 on sn-devel-104

libcli/security/security_descriptor.c

index 574dd4e317b1aa322ed294463c157bd26708f08d..25b316cdd2a10dadfc0eaa782633281b874c3025 100644 (file)
@@ -564,21 +564,19 @@ struct security_ace *security_ace_create(TALLOC_CTX *mem_ctx,
                                         uint8_t flags)
 
 {
-       struct dom_sid *sid;
        struct security_ace *ace;
+       bool ok;
 
        ace = talloc_zero(mem_ctx, struct security_ace);
        if (ace == NULL) {
                return NULL;
        }
 
-       sid = dom_sid_parse_talloc(ace, sid_str);
-       if (sid == NULL) {
+       ok = dom_sid_parse(sid_str, &ace->trustee);
+       if (!ok) {
                talloc_free(ace);
                return NULL;
        }
-
-       ace->trustee = *sid;
        ace->type = type;
        ace->access_mask = access_mask;
        ace->flags = flags;