winbind: Save lines with talloc_asprintf_addbuf()
authorVolker Lendecke <vl@samba.org>
Wed, 30 Nov 2022 13:28:54 +0000 (14:28 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 14 Dec 2022 04:32:34 +0000 (04:32 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/idmap_ad.c

index e80b823ccdff9bc6e3d98ae033ec88dc62940e09..1f0dd54456c7b268c67aee38fccb47b90c4a41f2 100644 (file)
@@ -99,19 +99,12 @@ static TLDAPRC get_attrnames_by_oids(struct tldap_context *ld,
        size_t num_msgs;
 
        filter = talloc_strdup(mem_ctx, "(|");
-       if (filter == NULL) {
-               return TLDAP_NO_MEMORY;
-       }
 
        for (i=0; i<num_oids; i++) {
-               filter = talloc_asprintf_append_buffer(
-                       filter, "(attributeId=%s)", oids[i]);
-               if (filter == NULL) {
-                       return TLDAP_NO_MEMORY;
-               }
+               talloc_asprintf_addbuf(&filter, "(attributeId=%s)", oids[i]);
        }
+       talloc_asprintf_addbuf(&filter, ")");
 
-       filter = talloc_asprintf_append_buffer(filter, ")");
        if (filter == NULL) {
                return TLDAP_NO_MEMORY;
        }