diff options
author | Sumit Bose <sbose@redhat.com> | 2013-10-09 15:20:38 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-10-17 13:45:44 +0200 |
commit | cff4a89e38078337d74aa558f0e628d5756b3bba (patch) | |
tree | d2e275ecf4637e767929e99a47a3b465afdc70c5 | |
parent | 2105a6a63cb74bf009fb6e723e74f6ec075e1238 (diff) | |
download | sssd-cff4a89e38078337d74aa558f0e628d5756b3bba.tar.gz sssd-cff4a89e38078337d74aa558f0e628d5756b3bba.tar.xz sssd-cff4a89e38078337d74aa558f0e628d5756b3bba.zip |
idmap: add internal function to free a domain struct
-rw-r--r-- | src/lib/idmap/sss_idmap.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c index c7ac0c709..45797f227 100644 --- a/src/lib/idmap/sss_idmap.c +++ b/src/lib/idmap/sss_idmap.c @@ -213,6 +213,20 @@ enum idmap_error_code sss_idmap_init(idmap_alloc_func *alloc_func, return IDMAP_SUCCESS; } +static void sss_idmap_free_domain(struct sss_idmap_ctx *ctx, + struct idmap_domain_info *dom) +{ + if (ctx == NULL || dom == NULL) { + return; + } + + ctx->free_func(dom->range_id, ctx->alloc_pvt); + ctx->free_func(dom->range, ctx->alloc_pvt); + ctx->free_func(dom->name, ctx->alloc_pvt); + ctx->free_func(dom->sid, ctx->alloc_pvt); + ctx->free_func(dom, ctx->alloc_pvt); +} + enum idmap_error_code sss_idmap_free(struct sss_idmap_ctx *ctx) { struct idmap_domain_info *dom; @@ -224,10 +238,7 @@ enum idmap_error_code sss_idmap_free(struct sss_idmap_ctx *ctx) while (next) { dom = next; next = dom->next; - ctx->free_func(dom->range, ctx->alloc_pvt); - ctx->free_func(dom->name, ctx->alloc_pvt); - ctx->free_func(dom->sid, ctx->alloc_pvt); - ctx->free_func(dom, ctx->alloc_pvt); + sss_idmap_free_domain(ctx, dom); } ctx->free_func(ctx, ctx->alloc_pvt); |