lib: Simplify sid_binstring_hex()
authorVolker Lendecke <vl@samba.org>
Fri, 8 May 2015 07:06:53 +0000 (07:06 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 12 May 2015 23:44:20 +0000 (01:44 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/util_sid.c

index f051b7a1ff547fd7aeaa0028d18c71c0d3d59cc1..55904d7106370008c1278bed43eeb616e4dfee75 100644 (file)
@@ -115,14 +115,11 @@ bool non_mappable_sid(struct dom_sid *sid)
 
 char *sid_binstring_hex(const struct dom_sid *sid)
 {
-       char *buf, *s;
+       char *s;
        int len = ndr_size_dom_sid(sid, 0);
-       buf = (char *)SMB_MALLOC(len);
-       if (!buf)
-               return NULL;
+       char buf[len];
        sid_linearize(buf, len, sid);
        hex_encode((const unsigned char *)buf, len, &s);
-       free(buf);
        return s;
 }