From 69e96f08f1def1c28abe928ccbb0717566e49c8c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 23 Oct 2009 15:11:08 +0200 Subject: s4:dsdb/partition_init: don't leak a talloc_new() in case we have no data yet metze --- source4/dsdb/samdb/ldb_modules/partition_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c index cc778d6a71..28eab9b2ee 100644 --- a/source4/dsdb/samdb/ldb_modules/partition_init.c +++ b/source4/dsdb/samdb/ldb_modules/partition_init.c @@ -353,22 +353,25 @@ static int add_partition_to_data(struct ldb_context *ldb, struct partition_priva int partition_reload_if_required(struct ldb_module *module, struct partition_private_data *data) - { uint64_t seq; int ret, i; struct ldb_context *ldb = ldb_module_get_ctx(module); struct ldb_message *msg; struct ldb_message_element *partition_attributes; - TALLOC_CTX *mem_ctx = talloc_new(data); + TALLOC_CTX *mem_ctx; + if (!data) { /* Not initilised yet */ return LDB_SUCCESS; } + + mem_ctx = talloc_new(data); if (!mem_ctx) { ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } + ret = partition_primary_sequence_number(module, mem_ctx, LDB_SEQ_HIGHEST_SEQ, &seq); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); -- cgit