check handler before freeing it
authorAlan T. DeKok <aland@freeradius.org>
Tue, 7 Feb 2017 15:43:06 +0000 (10:43 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 7 Feb 2017 15:43:06 +0000 (10:43 -0500)
src/modules/rlm_eap/rlm_eap.c

index 38b6829..356038a 100644 (file)
@@ -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);
        }
 
        /*