]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli: Slightly streamline sddl_flags_to_string()
authorVolker Lendecke <vl@samba.org>
Thu, 30 Jul 2026 12:25:54 +0000 (14:25 +0200)
committerAnoop C S <anoopcs@samba.org>
Mon, 3 Aug 2026 09:05:30 +0000 (09:05 +0000)
Only check for talloc failure once with talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
libcli/security/sddl.c

index 215321adb61fa7fd4bb090afeb5df5115771b135..fe24d4892b252b19ef5b515f2066ae723053e84f 100644 (file)
@@ -1051,12 +1051,15 @@ static char *sddl_flags_to_string(TALLOC_CTX *mem_ctx, const struct flag_map *ma
        /* now by bits */
        for (i=0;map[i].name;i++) {
                if ((flags & map[i].flag) != 0) {
-                       s = talloc_asprintf_append_buffer(s, "%s", map[i].name);
-                       if (s == NULL) goto failed;
+                       talloc_asprintf_addbuf(&s, "%s", map[i].name);
                        flags &= ~map[i].flag;
                }
        }
 
+       if (s == NULL) {
+               goto failed;
+       }
+
        if (check_all && flags != 0) {
                goto failed;
        }