summaryrefslogtreecommitdiff
path: root/lib/ntdb/summary.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-19 12:42:08 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:07 +0200
commitd938c0b591d9c4aff9c92ae5eedd26ed97455f42 (patch)
treee3744f9c660fbf23d759493e0391d577e528ffcd /lib/ntdb/summary.c
parent6d5a3e1602a1db8ca8e778f5e4f40bb623dff1e7 (diff)
downloadsamba-d938c0b591d9c4aff9c92ae5eedd26ed97455f42.tar.gz
samba-d938c0b591d9c4aff9c92ae5eedd26ed97455f42.tar.bz2
samba-d938c0b591d9c4aff9c92ae5eedd26ed97455f42.zip
ntdb: allocator attribute.
This is designed to allow us to make ntdb_context (and NTDB_DATA returned from ntdb_fetch) a talloc pointer. But it can also be used for any other alternate allocator. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ntdb/summary.c')
-rw-r--r--lib/ntdb/summary.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/ntdb/summary.c b/lib/ntdb/summary.c
index 571d48ff4d..f5313bec55 100644
--- a/lib/ntdb/summary.c
+++ b/lib/ntdb/summary.c
@@ -261,7 +261,7 @@ _PUBLIC_ enum NTDB_ERROR ntdb_summary(struct ntdb_context *ntdb,
+ num_caps * (strlen(CAPABILITY_FORMAT) + 20
+ strlen(" (uncheckable,read-only)"));
- *summary = malloc(len);
+ *summary = ntdb->alloc_fn(ntdb, len, ntdb->alloc_data);
if (!*summary) {
ecode = ntdb_logerr(ntdb, NTDB_ERR_OOM, NTDB_LOG_ERROR,
"ntdb_summary: failed to allocate string");
@@ -309,20 +309,20 @@ _PUBLIC_ enum NTDB_ERROR ntdb_summary(struct ntdb_context *ntdb,
add_capabilities(ntdb, *summary);
unlock:
- free(hashesg);
- free(freeg);
- free(keysg);
- free(datag);
- free(extrag);
- free(uncoalg);
- free(hashes);
- free(freet);
- free(keys);
- free(data);
- free(extra);
- free(uncoal);
- free(ftables);
- free(chains);
+ ntdb->free_fn(hashesg, ntdb->alloc_data);
+ ntdb->free_fn(freeg, ntdb->alloc_data);
+ ntdb->free_fn(keysg, ntdb->alloc_data);
+ ntdb->free_fn(datag, ntdb->alloc_data);
+ ntdb->free_fn(extrag, ntdb->alloc_data);
+ ntdb->free_fn(uncoalg, ntdb->alloc_data);
+ ntdb->free_fn(hashes, ntdb->alloc_data);
+ ntdb->free_fn(freet, ntdb->alloc_data);
+ ntdb->free_fn(keys, ntdb->alloc_data);
+ ntdb->free_fn(data, ntdb->alloc_data);
+ ntdb->free_fn(extra, ntdb->alloc_data);
+ ntdb->free_fn(uncoal, ntdb->alloc_data);
+ ntdb->free_fn(ftables, ntdb->alloc_data);
+ ntdb->free_fn(chains, ntdb->alloc_data);
ntdb_allrecord_unlock(ntdb, F_RDLCK);
ntdb_unlock_expand(ntdb, F_RDLCK);