summaryrefslogtreecommitdiff
path: root/lib/ldb-samba
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2016-04-22 12:03:25 +1200
committerGarming Sam <garming@samba.org>2016-05-03 11:43:15 +0200
commit5359031e33ade12b56aaafcbc4eb1368d9eaccd1 (patch)
treeee3bb8cb1335c495e29bdfb4bd6358144d2f83f6 /lib/ldb-samba
parent98712e9bda29105ae23de487c3261ebf959408c5 (diff)
downloadsamba-5359031e33ade12b56aaafcbc4eb1368d9eaccd1.tar.gz
ldb-samba: Use ndr_pull_struct_blob_all_noalloc
This avoids pointless talloc() calls in a hot code path. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Tue May 3 11:43:15 CEST 2016 on sn-devel-144
Diffstat (limited to 'lib/ldb-samba')
-rw-r--r--lib/ldb-samba/ldif_handlers.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index fc13f074abd..d1b5bd74555 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -106,21 +106,15 @@ static int ldif_read_objectSid(struct ldb_context *ldb, void *mem_ctx,
int ldif_write_objectSid(struct ldb_context *ldb, void *mem_ctx,
const struct ldb_val *in, struct ldb_val *out)
{
- struct dom_sid *sid;
+ struct dom_sid sid;
enum ndr_err_code ndr_err;
- sid = talloc(mem_ctx, struct dom_sid);
- if (sid == NULL) {
- return -1;
- }
- ndr_err = ndr_pull_struct_blob_all(in, sid, sid,
+ ndr_err = ndr_pull_struct_blob_all_noalloc(in, &sid,
(ndr_pull_flags_fn_t)ndr_pull_dom_sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(sid);
return -1;
}
- *out = data_blob_string_const(dom_sid_string(mem_ctx, sid));
- talloc_free(sid);
+ *out = data_blob_string_const(dom_sid_string(mem_ctx, &sid));
if (out->data == NULL) {
return -1;
}
@@ -210,7 +204,7 @@ static int extended_dn_read_SID(struct ldb_context *ldb, void *mem_ctx,
(const char *)in->data, in->length);
/* Check it looks like a SID */
- ndr_err = ndr_pull_struct_blob_all(out, mem_ctx, &sid,
+ ndr_err = ndr_pull_struct_blob_all_noalloc(out, &sid,
(ndr_pull_flags_fn_t)ndr_pull_dom_sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return -1;