Module: sip-router
Branch: tirpi/cfg_framework_multivalue
Commit: 54d8259ea0bd7ab6a80a996d9cc1fcfa398fecf5
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=54d8259…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Thu Sep 9 09:55:04 2010 +0200
cfg framework: group instance bug fixes
- Check whether the new config block is really created.
- Increase the number if items within the array when a new
instance is added
---
cfg/cfg_ctx.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/cfg/cfg_ctx.c b/cfg/cfg_ctx.c
index 94f2d98..480fab5 100644
--- a/cfg/cfg_ctx.c
+++ b/cfg/cfg_ctx.c
@@ -512,7 +512,7 @@ int cfg_set_now(cfg_ctx_t *ctx, str *group_name, unsigned int
*group_id, str *va
it cannot be freed */
if (cfg_shmized) {
- if (!group_inst && CFG_GROUP_META(block, group)->array) {
+ if (!group_inst && block && CFG_GROUP_META(block, group)->array) {
if (cfg_update_defaults(CFG_GROUP_META(block, group),
group, var, p,
((var->def->type & CFG_ATOMIC) == 0)) /* clone if needed */
@@ -1281,6 +1281,7 @@ int cfg_add_group_inst(cfg_ctx_t *ctx, str *group_name, unsigned int
group_id)
sizeof(cfg_group_inst_t) + group->size - 1);
CFG_GROUP_META(block, group)->array = new_array;
+ CFG_GROUP_META(block, group)->num++;
if (CFG_GROUP_META(*cfg_global, group)->array) {
/* prepare the array of the replaced strings,