summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2021-10-06 10:09:45 +0200
committerJeremy Allison <jra@samba.org>2021-10-08 19:28:31 +0000
commit4869497b709789d159e2b0f917218f57516d2e09 (patch)
tree5f25f55bf77797cfe802a5445bb08b1adadbabda /source3/winbindd
parent0853a7a2bbfc8dc32c3ec1fa9498d01c02080217 (diff)
downloadsamba-4869497b709789d159e2b0f917218f57516d2e09.tar.gz
winbind: Simplify winbindd_getsidaliases_recv()
Use talloc_asprintf_addbuf(), fix an realloc error path memleak Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_getsidaliases.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/winbindd/winbindd_getsidaliases.c b/source3/winbindd/winbindd_getsidaliases.c
index 6b1084a4a39..48c1596e1bd 100644
--- a/source3/winbindd/winbindd_getsidaliases.c
+++ b/source3/winbindd/winbindd_getsidaliases.c
@@ -134,20 +134,20 @@ NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req,
}
sidlist = talloc_strdup(response, "");
- if (sidlist == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
+
for (i=0; i<state->num_aliases; i++) {
struct dom_sid sid;
struct dom_sid_buf tmp;
sid_compose(&sid, &state->sid, state->aliases[i]);
- sidlist = talloc_asprintf_append_buffer(
- sidlist, "%s\n", dom_sid_str_buf(&sid, &tmp));
- if (sidlist == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
+ talloc_asprintf_addbuf(
+ &sidlist, "%s\n", dom_sid_str_buf(&sid, &tmp));
}
+
+ if (sidlist == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
response->extra_data.data = sidlist;
response->length += talloc_get_size(sidlist);
response->data.num_entries = state->num_aliases;