fixing the parameter of the per-child process callback, it did not
authorMiklos Tirpak <miklos@iptel.org>
Wed, 13 Feb 2008 16:14:21 +0000 (16:14 +0000)
committerMiklos Tirpak <miklos@iptel.org>
Wed, 13 Feb 2008 16:14:21 +0000 (16:14 +0000)
alway contain the variable name properly

cfg/cfg_ctx.c

index df7458d..c3b411e 100644 (file)
@@ -304,7 +304,11 @@ int cfg_set_now(cfg_ctx_t *ctx, str *group_name, str *var_name,
        }
 
        if (var->def->on_set_child_cb) {
-               child_cb = cfg_child_cb_new(var_name,
+               /* get the name of the variable from the internal struct,
+               because var_name may be freed before the callback needs it */
+               s.s = var->def->name;
+               s.len = var->name_len;
+               child_cb = cfg_child_cb_new(&s,
                                        var->def->on_set_child_cb);
                if (!child_cb) {
                        LOG(L_ERR, "ERROR: cfg_set_now(): not enough shm memory\n");