From 656c828b9fcd8538b1503f86f8ac499837d7fc59 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 16 Dec 2010 22:28:45 +1100 Subject: lib/ldb Remove talloc_free() that causes double-free in callbacks. This partially reverts 0941099a, which was a little over-eager in fixing what were presumed to be memory leaks. It is always the callbacks responsiblity to free the ares, but if they don't then the end of the request should handle the cleanup. Attempting to talloc_free() here will result (as it did in the descriptor module) in a double-free error if the callback does free it, and no other caller of ldb_module_send_entry() has this behaviour. Andrew Bartlett --- source4/lib/ldb/ldb_tdb/ldb_index.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index 71cffb90b3..02e4acbbde 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -966,7 +966,9 @@ static int ltdb_index_filter(const struct dn_list *dn_list, ret = ldb_module_send_entry(ac->req, msg, NULL); if (ret != LDB_SUCCESS) { - talloc_free(msg); + /* Regardless of success or failure, the msg + * is the callbacks responsiblity, and should + * not be talloc_free()'ed */ ac->request_terminated = true; return ret; } -- cgit