1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

lib/ldb-samba: Use ndr_push_struct_into_fixed_blob() in ldif_handlers.c

This avoids a number of pointless and pointlessly-large allocations
in inner loops.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2016-06-27 10:52:55 +12:00 committed by Stefan Metzmacher
parent 1246904d41
commit cb6395c858

View File

@ -91,8 +91,15 @@ static int ldif_read_objectSid(struct ldb_context *ldb, void *mem_ctx,
if (sid == NULL) {
return -1;
}
ndr_err = ndr_push_struct_blob(out, mem_ctx, sid,
(ndr_push_flags_fn_t)ndr_push_dom_sid);
*out = data_blob_talloc(mem_ctx, NULL,
ndr_size_dom_sid(sid, 0));
if (out->data == NULL) {
return -1;
}
ndr_err = ndr_push_struct_into_fixed_blob(out, sid,
(ndr_push_flags_fn_t)ndr_push_dom_sid);
talloc_free(sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return -1;