]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Use talloc_asprintf_addbuf() in utok_string()
authorVolker Lendecke <vl@samba.org>
Wed, 6 Oct 2021 08:01:07 +0000 (10:01 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 8 Oct 2021 19:28:31 +0000 (19:28 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/util.c

index 7d9af875a74b9ba862eeaa237212a7bd37aedee8..58a42ef2f53d5a0e70c850f93c96c7242f579829 100644 (file)
@@ -2030,19 +2030,10 @@ char *utok_string(TALLOC_CTX *mem_ctx, const struct security_unix_token *tok)
                (uintmax_t)(tok->uid),
                (uintmax_t)(tok->gid),
                tok->ngroups);
-       if (str == NULL) {
-               return NULL;
-       }
 
        for (i=0; i<tok->ngroups; i++) {
-               char *tmp;
-               tmp = talloc_asprintf_append_buffer(
-                       str, " %ju", (uintmax_t)tok->groups[i]);
-               if (tmp == NULL) {
-                       TALLOC_FREE(str);
-                       return NULL;
-               }
-               str = tmp;
+               talloc_asprintf_addbuf(
+                       &str, " %ju", (uintmax_t)tok->groups[i]);
        }
 
        return str;