summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-04-25 12:46:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:40 -0500
commitfe4d985b6f3d318d9b58a16677be3b4ae34fba15 (patch)
tree2cc878469fa214d73b852341e080d176a9577d3f /source4/dsdb
parentc06297f776d92354e92f0ddda659778d57f426e5 (diff)
downloadsamba-fe4d985b6f3d318d9b58a16677be3b4ae34fba15.tar.gz
samba-fe4d985b6f3d318d9b58a16677be3b4ae34fba15.tar.bz2
samba-fe4d985b6f3d318d9b58a16677be3b4ae34fba15.zip
r6470: Remove ldb_search_free() it is not needed anymore.
Just use talloc_free() to release the memory after an ldb_search(). (This used to be commit 4f0948dab0aa5e8b6a4ce486f3668ca8dfae23db)
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c30
-rw-r--r--source4/dsdb/samdb/samdb.c15
2 files changed, 15 insertions, 30 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 7ec1ea1a29..a392f97865 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -51,12 +51,6 @@ static int samldb_search(struct ldb_module *module, const char *base,
return ldb_next_search(module, base, scope, expression, attrs, res);
}
-static int samldb_search_free(struct ldb_module *module, struct ldb_message **res)
-{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "samldb_search_free\n");
- return ldb_next_search_free(module, res);
-}
-
/*
allocate a new id, attempting to do it atomically
return 0 on failure, the id on success
@@ -74,13 +68,13 @@ static int samldb_allocate_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx
ret = ldb_search(ldb, dn, LDB_SCOPE_BASE, "nextRid=*", attrs, &res);
if (ret != 1) {
- if (res) ldb_search_free(ldb, res);
+ if (res) talloc_free(res);
return -1;
}
str = ldb_msg_find_string(res[0], "nextRid", NULL);
if (str == NULL) {
ldb_debug(ldb, LDB_DEBUG_FATAL, "attribute nextRid not found in %s\n", dn);
- ldb_search_free(ldb, res);
+ talloc_free(res);
return -1;
}
@@ -88,10 +82,10 @@ static int samldb_allocate_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx
if ((*id)+1 == 0) {
/* out of IDs ! */
ldb_debug(ldb, LDB_DEBUG_FATAL, "Are we out of valid IDs ?\n");
- ldb_search_free(ldb, res);
+ talloc_free(res);
return -1;
}
- ldb_search_free(ldb, res);
+ talloc_free(res);
/* we do a delete and add as a single operation. That prevents
a race */
@@ -150,7 +144,7 @@ static char *samldb_search_domain(struct ldb_module *module, TALLOC_CTX *mem_ctx
sdn++;
ret = ldb_search(module->ldb, sdn, LDB_SCOPE_BASE, "objectClass=domain", NULL, &res);
- ldb_search_free(module->ldb, res);
+ talloc_free(res);
if (ret == 1)
break;
@@ -195,14 +189,14 @@ static char *samldb_get_new_sid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
ret = ldb_search(module->ldb, dom_dn, LDB_SCOPE_BASE, "objectSid=*", attrs, &res);
if (ret != 1) {
ldb_debug(module->ldb, LDB_DEBUG_FATAL, "samldb_get_new_sid: error retrieving domain sid!\n");
- if (res) ldb_search_free(module->ldb, res);
+ if (res) talloc_free(res);
return NULL;
}
dom_sid = ldb_msg_find_string(res[0], "objectSid", NULL);
if (dom_sid == NULL) {
ldb_debug(module->ldb, LDB_DEBUG_FATAL, "samldb_get_new_sid: error retrieving domain sid!\n");
- ldb_search_free(module->ldb, res);
+ talloc_free(res);
return NULL;
}
@@ -218,7 +212,7 @@ static char *samldb_get_new_sid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
}
if (ret != 0) {
ldb_debug(module->ldb, LDB_DEBUG_FATAL, "Failed to increment nextRid of %s\n", dom_dn);
- ldb_search_free(module->ldb, res);
+ talloc_free(res);
return NULL;
}
@@ -226,7 +220,8 @@ static char *samldb_get_new_sid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
obj_sid = talloc_asprintf(mem_ctx, "%s-%u", dom_sid, rid);
- ldb_search_free(module->ldb, res);
+ talloc_free(res);
+
return obj_sid;
}
@@ -349,13 +344,13 @@ static int samldb_copy_template(struct ldb_module *module, struct ldb_message *m
NULL,
(char *)el->values[j].data)) {
ldb_debug(module->ldb, LDB_DEBUG_FATAL, "Attribute adding failed...\n");
- ldb_search_free(module->ldb, res);
+ talloc_free(res);
return -1;
}
}
}
- ldb_search_free(module->ldb, res);
+ talloc_free(res);
return 0;
}
@@ -606,7 +601,6 @@ static int samldb_destructor(void *module_ctx)
static const struct ldb_module_ops samldb_ops = {
"samldb",
samldb_search,
- samldb_search_free,
samldb_add_record,
samldb_modify_record,
samldb_delete_record,
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 6f9251dd32..b337577ae7 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -79,15 +79,6 @@ int samdb_search_domain(struct ldb_context *sam_ldb,
}
/*
- free up a search result
-*/
-int samdb_search_free(struct ldb_context *sam_ldb,
- TALLOC_CTX *mem_ctx, struct ldb_message **res)
-{
- return ldb_search_free(sam_ldb, res);
-}
-
-/*
search the sam for a single string attribute in exactly 1 record
*/
const char *samdb_search_string_v(struct ldb_context *sam_ldb,
@@ -106,7 +97,7 @@ const char *samdb_search_string_v(struct ldb_context *sam_ldb,
attr_name, format, count));
}
if (count != 1) {
- samdb_search_free(sam_ldb, mem_ctx, res);
+ talloc_free(res);
return NULL;
}
@@ -235,14 +226,14 @@ int samdb_search_string_multiple(struct ldb_context *sam_ldb,
if (res[i]->num_elements != 1) {
DEBUG(1,("samdb: search for %s %s not single valued\n",
attr_name, format));
- samdb_search_free(sam_ldb, mem_ctx, res);
+ talloc_free(res);
return -1;
}
}
*strs = talloc_array(mem_ctx, const char *, count+1);
if (! *strs) {
- samdb_search_free(sam_ldb, mem_ctx, res);
+ talloc_free(res);
return -1;
}