1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r19314: Commit tridge's fixes for a big mem leak in ltdb I introduced

when the code has been changed to be async.
With the other committed fixes now this works.
(This used to be commit 49fc640b5c)
This commit is contained in:
Simo Sorce 2006-10-16 03:15:41 +00:00 committed by Gerald (Jerry) Carter
parent b0fadb51b2
commit 1b8e6fa6e9
3 changed files with 10 additions and 13 deletions

View File

@ -499,12 +499,11 @@ int ltdb_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }
req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); req->handle = init_ltdb_handle(ltdb, module, req);
if (req->handle == NULL) { if (req->handle == NULL) {
ltdb_unlock_read(module); ltdb_unlock_read(module);
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }
ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context); ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context);
ltdb_ac->tree = req->op.search.tree; ltdb_ac->tree = req->op.search.tree;

View File

@ -79,13 +79,12 @@ static int ltdb_err_map(enum TDB_ERROR tdb_code)
struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module, struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
void *context, struct ldb_request *req)
int (*callback)(struct ldb_context *, void *, struct ldb_reply *))
{ {
struct ltdb_context *ac; struct ltdb_context *ac;
struct ldb_handle *h; struct ldb_handle *h;
h = talloc_zero(ltdb, struct ldb_handle); h = talloc_zero(req, struct ldb_handle);
if (h == NULL) { if (h == NULL) {
ldb_set_errstring(module->ldb, "Out of Memory"); ldb_set_errstring(module->ldb, "Out of Memory");
return NULL; return NULL;
@ -106,8 +105,8 @@ struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module
h->status = LDB_SUCCESS; h->status = LDB_SUCCESS;
ac->module = module; ac->module = module;
ac->context = context; ac->context = req->context;
ac->callback = callback; ac->callback = req->callback;
return h; return h;
} }
@ -307,7 +306,7 @@ static int ltdb_add(struct ldb_module *module, struct ldb_request *req)
} }
} }
req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); req->handle = init_ltdb_handle(ltdb, module, req);
if (req->handle == NULL) { if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }
@ -416,7 +415,7 @@ static int ltdb_delete(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }
req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); req->handle = init_ltdb_handle(ltdb, module, req);
if (req->handle == NULL) { if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }
@ -772,7 +771,7 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req)
req->handle = NULL; req->handle = NULL;
req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); req->handle = init_ltdb_handle(ltdb, module, req);
if (req->handle == NULL) { if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }
@ -826,7 +825,7 @@ static int ltdb_rename(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }
req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); req->handle = init_ltdb_handle(ltdb, module, req);
if (req->handle == NULL) { if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;
} }

View File

@ -110,8 +110,7 @@ int ltdb_search(struct ldb_module *module, struct ldb_request *req);
/* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */ /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module, struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
void *context, struct ldb_request *req);
int (*callback)(struct ldb_context *, void *, struct ldb_reply *));
struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn); struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn);
int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs); int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn); int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn);