summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-04-13 17:09:09 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-04-14 11:47:08 -0400
commit9e7b2ad231364ceaaa6c75c606e431b774e5fd37 (patch)
treed8f08cea688dffee5bcceeea472beccd03d5aa67
parentaa1514886aee21bb89ac946a724d8cfcab4383ce (diff)
downloadsssd-9e7b2ad231364ceaaa6c75c606e431b774e5fd37.tar.gz
sssd-9e7b2ad231364ceaaa6c75c606e431b774e5fd37.tar.xz
sssd-9e7b2ad231364ceaaa6c75c606e431b774e5fd37.zip
memberof: free delete operation apyload once done
Large memberof delete operations can cause quite a number of searches and the results are attached to a delop operation structure. Make sure we free this payload once the operation is done and these results are not used anymore so that we get a smaller total memory footprint.
-rw-r--r--src/ldb_modules/memberof.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index d779078b9..b55ba1d2c 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -1161,6 +1161,7 @@ static int mbof_del_fill_muop(struct mbof_del_ctx *del_ctx,
static int mbof_del_muop(struct mbof_del_ctx *ctx);
static int mbof_del_muop_callback(struct ldb_request *req,
struct ldb_reply *ares);
+static void free_delop_contents(struct mbof_del_operation *delop);
static int memberof_del(struct ldb_module *module, struct ldb_request *req)
@@ -2189,6 +2190,8 @@ static int mbof_del_progeny(struct mbof_del_operation *delop)
return ret;
}
+ free_delop_contents(delop);
+
if (nextop) {
return mbof_del_execute_op(nextop);
}
@@ -2412,7 +2415,16 @@ static int mbof_del_muop_callback(struct ldb_request *req,
return LDB_SUCCESS;
}
-
+/* delop may carry on a lot of memory, so we need a function to clean up
+ * the payload without breaking the delop chain */
+static void free_delop_contents(struct mbof_del_operation *delop)
+{
+ talloc_zfree(delop->entry);
+ talloc_zfree(delop->parents);
+ talloc_zfree(delop->anc_ctx);
+ delop->num_parents = 0;
+ delop->cur_parent = 0;
+}
/* mod operation */