From: Alan T. DeKok Date: Tue, 7 Feb 2017 15:43:06 +0000 (-0500) Subject: check handler before freeing it X-Git-Tag: release_3_0_13~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8289a04ad7e3ce384f45a6d4ae8097f0d96d7d4b;p=thirdparty%2Ffreeradius-server.git check handler before freeing it --- diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 38b6829dbab..356038a89ea 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -408,29 +408,29 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, REQUEST *re } } else { - RDEBUG2("Freeing handler"); - /* handler is not required any more, free it now */ - talloc_free(handler); - } + /* + * Enable the cached entry on success. + */ + if (handler->eap_ds->request->code == PW_EAP_SUCCESS) { + VALUE_PAIR *vp; - /* - * Enable the cached entry on success. - */ - if (handler->eap_ds->request->code == PW_EAP_SUCCESS) { - VALUE_PAIR *vp; + vp = fr_pair_find_by_num(request->state, PW_TLS_CACHE_FILENAME, 0, TAG_ANY); + if (vp) (void) chmod(vp->vp_strvalue, S_IRUSR | S_IWUSR); + } - vp = fr_pair_find_by_num(request->state, PW_TLS_CACHE_FILENAME, 0, TAG_ANY); - if (vp) (void) chmod(vp->vp_strvalue, S_IRUSR | S_IWUSR); - } + /* + * Disable the cached entry on failure. + */ + if (handler->eap_ds->request->code == PW_EAP_FAILURE) { + VALUE_PAIR *vp; - /* - * Disable the cached entry on failure. - */ - if (handler->eap_ds->request->code == PW_EAP_FAILURE) { - VALUE_PAIR *vp; + vp = fr_pair_find_by_num(request->state, PW_TLS_CACHE_FILENAME, 0, TAG_ANY); + if (vp) (void) unlink(vp->vp_strvalue); + } - vp = fr_pair_find_by_num(request->state, PW_TLS_CACHE_FILENAME, 0, TAG_ANY); - if (vp) (void) unlink(vp->vp_strvalue); + RDEBUG2("Freeing handler"); + /* handler is not required any more, free it now */ + talloc_free(handler); } /*