summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-04-13 15:21:32 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-04-14 13:03:13 -0400
commit0de124abf79be1bb9fcfec251b9df8880159817c (patch)
treedfe41784e12a64127b32ebe9ecac33d942f5505d
parentae8038f78ca24eba36159876c5089386fbdd15a1 (diff)
downloadsssd-0de124abf79be1bb9fcfec251b9df8880159817c.tar.gz
sssd-0de124abf79be1bb9fcfec251b9df8880159817c.tar.xz
sssd-0de124abf79be1bb9fcfec251b9df8880159817c.zip
memberof: free delete operation payload once donesssd-1.5.1-29.el5
memberof: fix calculation of replaced members We were skipping the check on the next value in the added list when a match was found for the currentr value being checked. 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.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index 372aa544f..31547464c 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -1156,6 +1156,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)
@@ -2184,6 +2185,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);
}
@@ -2407,7 +2410,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 */
@@ -2729,6 +2741,7 @@ static int mbof_mod_process(struct mbof_mod_ctx *mod_ctx, bool *done)
added->dns[j] = added->dns[j+1];
}
added->num--;
+ i--;
}
}
}