Module: sip-router Branch: master Commit: 78ccd1bb98b1329f0ee9d5acaaa5242ef4d797bc URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=78ccd1bb...
Author: Miklos Tirpak miklos@iptel.org Committer: Miklos Tirpak miklos@iptel.org Date: Fri Jun 24 15:10:51 2011 +0200
cfg framework: set the handle before creating the cfg group
The handle must be set before the config group is created because the related functions save the value for future use.
The tcp and sctp config handles are not initialized to the default config struction. This cased a crash because orig_handle was set to the initial value which is uninitialized.
---
cfg/cfg.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/cfg/cfg.c b/cfg/cfg.c index 2d0f640..0c4d404 100644 --- a/cfg/cfg.c +++ b/cfg/cfg.c @@ -141,6 +141,14 @@ int cfg_declare(char *group_name, cfg_def_t *def, void *values, int def_size, goto error; }
+ /* The cfg variables are ready to use, let us set the handle + before passing the new definitions to the drivers. + We make the interface usable for the fixup functions + at this step + cfg_set_group() and cfg_new_group() need the handle to be set because + they save its original value. */ + *handle = values; + group_name_len = strlen(group_name); /* check for duplicates */ if ((group = cfg_lookup_group(group_name, group_name_len))) { @@ -162,12 +170,6 @@ int cfg_declare(char *group_name, cfg_def_t *def, void *values, int def_size, } group->dynamic = CFG_GROUP_STATIC;
- /* The cfg variables are ready to use, let us set the handle - before passing the new definitions to the drivers. - We make the interface usable for the fixup functions - at this step */ - *handle = values; - /* notify the drivers about the new config definition */ cfg_notify_drivers(group_name, group_name_len, def);