diff options
author | Simo Sorce <ssorce@redhat.com> | 2011-04-13 17:09:09 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-04-14 11:46:35 -0400 |
commit | 89bff384bccda7e211649dffc40f24a7bdd552df (patch) | |
tree | 6341cfcb5595f245d313e80acdde8c32ca441a9d /src/ldb_modules/memberof.c | |
parent | cb57eaf0f8a3fa44776e9b9ea5165304e719d17d (diff) | |
download | sssd-89bff384bccda7e211649dffc40f24a7bdd552df.tar.gz sssd-89bff384bccda7e211649dffc40f24a7bdd552df.tar.xz sssd-89bff384bccda7e211649dffc40f24a7bdd552df.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.
Diffstat (limited to 'src/ldb_modules/memberof.c')
-rw-r--r-- | src/ldb_modules/memberof.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c index 41ea0b344..4fc46fa84 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) @@ -2182,6 +2183,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); } @@ -2405,7 +2408,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 */ |