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:49:49 +0200 |
commit | 810e8dfb1523362a0e6ed5a3a218722be97f9607 (patch) | |
tree | d8e1104d08a66a29ca8f59bd15397bd0f2120f1f /src/lib | |
parent | e30fbb81f5406ed8556df06288e97a39b54c843c (diff) | |
download | sssd-810e8dfb1523362a0e6ed5a3a218722be97f9607.tar.gz sssd-810e8dfb1523362a0e6ed5a3a218722be97f9607.tar.xz sssd-810e8dfb1523362a0e6ed5a3a218722be97f9607.zip |
idmap: add internal function to free a domain struct
Diffstat (limited to 'src/lib')
-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); |