summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-31 10:03:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:39 -0500
commitf9316daa4697bea13d2795c95a1486119de56e67 (patch)
treef135ac706db2523fcf2da4440600aaa6420a032a /source4/dsdb/samdb/ldb_modules
parent60f8666ae88c5a03b0da58acb94015337442e18b (diff)
downloadsamba-f9316daa4697bea13d2795c95a1486119de56e67.tar.gz
samba-f9316daa4697bea13d2795c95a1486119de56e67.tar.bz2
samba-f9316daa4697bea13d2795c95a1486119de56e67.zip
r13256: Free temporary memory on error cases, and try to clean up what's left
earlier. Move gendb_search() to use talloc_vasprintf() and steal only the parts actually being used for the results. Andrew Bartlett (This used to be commit 53efb3e3e980c768e0aee216ccd8dc3e14707246)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 6e55816d72..630edf1c7a 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -157,6 +157,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r
/* look again, this time at the copied attribute */
if (!msg2 || (attribute = ldb_msg_find_element(msg2, "sambaPassword")) == NULL ) {
+ talloc_free(mem_ctx);
/* Gah? where did it go? Oh well... */
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -170,6 +171,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r
talloc_asprintf(mem_ctx, "sambaPassword_handle: "
"attempted set of multiple sambaPassword attributes on %s rejected",
ldb_dn_linearize(mem_ctx, dn)));
+ talloc_free(mem_ctx);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
@@ -184,6 +186,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r
talloc_asprintf(mem_ctx, "sambaPassword_handle: "
"attempted set of multiple sambaPassword attributes on %s rejected",
ldb_dn_linearize(mem_ctx, dn)));
+ talloc_free(mem_ctx);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
@@ -212,6 +215,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r
/* Send the (modified) request of the original caller down to the database */
ret = ldb_next_request(module, modified_orig_request);
if (ret) {
+ talloc_free(mem_ctx);
return ret;
}
@@ -226,6 +230,8 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r
/* Find out the old passwords details of the user */
old_res = search_request->op.search.res;
+ talloc_steal(mem_ctx, old_res);
+ talloc_free(search_request);
if (old_res->count != 1) {
ldb_set_errstring(module,
@@ -270,6 +276,9 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r
/* Find out the full details of the user */
res = search_request->op.search.res;
+ talloc_steal(mem_ctx, res);
+ talloc_free(search_request);
+
if (res->count != 1) {
ldb_set_errstring(module,
talloc_asprintf(mem_ctx, "password_hash_handle: "