mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
winbind: Simplify winbindd_sids_to_xids_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>
This commit is contained in:
parent
fc4ee9c494
commit
61b06695b7
@ -112,9 +112,6 @@ NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
|
||||
}
|
||||
|
||||
result = talloc_strdup(response, "");
|
||||
if (result == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
for (i=0; i<state->num_sids; i++) {
|
||||
char type = '\0';
|
||||
@ -143,17 +140,20 @@ NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
|
||||
}
|
||||
|
||||
if (found) {
|
||||
result = talloc_asprintf_append_buffer(
|
||||
result, "%c%lu\n", type,
|
||||
talloc_asprintf_addbuf(
|
||||
&result,
|
||||
"%c%lu\n",
|
||||
type,
|
||||
(unsigned long)xid.id);
|
||||
} else {
|
||||
result = talloc_asprintf_append_buffer(result, "\n");
|
||||
}
|
||||
if (result == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
talloc_asprintf_addbuf(&result, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (result == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
response->extra_data.data = result;
|
||||
response->length += talloc_get_size(result);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user