]> 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:40:10 +0000 (17:40 +0200)
src/modules/rlm_perl/rlm_perl.c

index c00e31c64e8d418a139fd87f4f05b4f6162e75de..ec57e9a77e316469d3f7f961fd57f76112b178fa 100644 (file)
@@ -430,6 +430,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;
        }
@@ -460,6 +461,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);
        }
 
@@ -473,6 +476,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;
        }
 
@@ -492,6 +497,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);
        }