Added additional fix for #348 - each instance will have its own interp and this
authorbjordanov <bjordanov>
Tue, 4 Apr 2006 14:27:25 +0000 (14:27 +0000)
committerbjordanov <bjordanov>
Tue, 4 Apr 2006 14:27:25 +0000 (14:27 +0000)
way shall avoid problems with multiple instances when destructing perl interp.

src/modules/rlm_perl/rlm_perl.c

index a7986ae..504ed69 100644 (file)
@@ -755,17 +755,16 @@ static int perl_instantiate(CONF_SECTION *conf, void **instance)
        }
 
 #ifdef USE_ITHREADS
-       if (!interp) {
-               if ((interp = perl_alloc()) == NULL) {
-                       radlog(L_DBG, "rlm_perl: No memory for allocating new perl !");
-                       return -1;
-               }
-               
-               perl_construct(interp);
-               PL_perl_destruct_level = 2;
+       inst->perl = interp;
+       
+       if ((inst->perl = perl_alloc()) == NULL) {
+               radlog(L_DBG, "rlm_perl: No memory for allocating new perl !");
+               return (-1);
        }
+               
+       perl_construct(inst->perl);
+       PL_perl_destruct_level = 2;
 
-       inst->perl = interp;
        {
        dTHXa(inst->perl);
        }