From: Volker Lendecke Date: Wed, 6 Oct 2021 08:01:07 +0000 (+0200) Subject: lib: Use talloc_asprintf_addbuf() in utok_string() X-Git-Tag: ldb-2.5.0~511 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0853a7a2bbfc8dc32c3ec1fa9498d01c02080217;p=thirdparty%2Fsamba.git lib: Use talloc_asprintf_addbuf() in utok_string() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/util.c b/source3/lib/util.c index 7d9af875a74..58a42ef2f53 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -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; ingroups; 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;