]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Free memory on instantiation error
authorAlan T. DeKok <aland@freeradius.org>
Wed, 19 Oct 2011 15:38:56 +0000 (17:38 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 19 Oct 2011 15:38:56 +0000 (17:38 +0200)
src/modules/rlm_perl/rlm_perl.c

index 18079a2f4a6fe9251c4a93f4a098b8297154020b..5c82e896db8ed9a094b11abfd200666dde33ca2b 100644 (file)
@@ -424,6 +424,7 @@ static int perl_instantiate(CONF_SECTION *conf, void **instance)
         *      fail.
         */
        if (cf_section_parse(conf, inst, module_config) < 0) {
+               free(embed);
                free(inst);
                return -1;
        }
@@ -454,6 +455,8 @@ static int perl_instantiate(CONF_SECTION *conf, void **instance)
 #ifdef USE_ITHREADS
        if ((inst->perl = perl_alloc()) == NULL) {
                radlog(L_DBG, "rlm_perl: No memory for allocating new perl !");
+               free(embed);
+               free(inst);
                return (-1);
        }
 
@@ -467,6 +470,8 @@ static int perl_instantiate(CONF_SECTION *conf, void **instance)
 #else
        if ((inst->perl = perl_alloc()) == NULL) {
                radlog(L_ERR, "rlm_perl: No memory for allocating new perl !");
+               free(embed);
+               free(inst);
                return -1;
        }
 
@@ -486,6 +491,8 @@ static int perl_instantiate(CONF_SECTION *conf, void **instance)
                exitstatus = perl_run(inst->perl);
        } else {
                radlog(L_ERR,"rlm_perl: perl_parse failed: %s not found or has syntax errors. \n", inst->module);
+               free(embed);
+               free(inst);
                return (-1);
        }