From: Alan T. DeKok Date: Wed, 19 Oct 2011 15:38:56 +0000 (+0200) Subject: Free memory on instantiation error X-Git-Tag: release_3_0_0_beta0~558 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c2314e11257b9ba9df7b714797701c8fd2a3b7d;p=thirdparty%2Ffreeradius-server.git Free memory on instantiation error --- diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index c00e31c64e8..ec57e9a77e3 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -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); }