]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbindd: Simplify winbindd_lookuprids_recv()
authorVolker Lendecke <vl@samba.org>
Tue, 24 Feb 2026 09:43:09 +0000 (10:43 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 25 Feb 2026 12:33:39 +0000 (12:33 +0000)
Only check for NULL once with talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
source3/winbindd/winbindd_lookuprids.c

index fc8fa46f4d3607fd6ada5ce42ad5810be0cf6298..f7650340d001bdcbb75eee9512b0d99ca87bf504 100644 (file)
@@ -128,18 +128,18 @@ NTSTATUS winbindd_lookuprids_recv(struct tevent_req *req,
        }
 
        result = talloc_strdup(response, "");
-       if (result == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
 
        for (i=0; i<state->names.num_principals; i++) {
                struct wbint_Principal *p = &state->names.principals[i];
 
-               result = talloc_asprintf_append_buffer(
-                       result, "%d %s\n", (int)p->type, p->name);
-               if (result == NULL) {
-                       return NT_STATUS_NO_MEMORY;
-               }
+               talloc_asprintf_addbuf(&result,
+                                      "%d %s\n",
+                                      (int)p->type,
+                                      p->name);
+       }
+
+       if (result == NULL) {
+               return NT_STATUS_NO_MEMORY;
        }
 
        fstrcpy(response->data.domain_name, state->domain_name);