Skip to content

Commit

Permalink
check handler before freeing it
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Feb 7, 2017
1 parent b58ae44 commit 8289a04
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/modules/rlm_eap/rlm_eap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 8289a04

Please sign in to comment.