From: Alan T. DeKok Date: Wed, 19 Oct 2011 15:38:56 +0000 (+0200) Subject: Free memory on instantiation error X-Git-Tag: release_2_2_0~289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a1fb5b0fca9fee3812dda9a041f3be6b435af9a;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 18079a2f4a6..5c82e896db8 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -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); }