xlat_name = cf_section_name*() means that it's free'd BEFORE
authoraland <aland>
Wed, 9 Jan 2008 13:20:56 +0000 (13:20 +0000)
committeraland <aland>
Wed, 9 Jan 2008 13:20:56 +0000 (13:20 +0000)
the module "detach" routine is called.  So we have to remember
it ourselves, to that we can un-register the xlat

src/modules/rlm_mschap/rlm_mschap.c

index f85b284..54682fe 100644 (file)
@@ -629,6 +629,7 @@ static int mschap_detach(void *instance){
 #define inst ((rlm_mschap_t *)instance)
        if (inst->xlat_name) {
                xlat_unregister(inst->xlat_name, mschap_xlat);
+               free(inst->xlat_name);
        }
        free(instance);
        return 0;
@@ -671,6 +672,7 @@ static int mschap_instantiate(CONF_SECTION *conf, void **instance)
         */
        inst->xlat_name = cf_section_name2(conf);
        if (!inst->xlat_name) inst->xlat_name = cf_section_name1(conf);
+       inst->xlat_name = strdup(inst->xlat_name);
        xlat_register(inst->xlat_name, mschap_xlat, inst);
 
        /*