PEAP tunnel data should be parented by the tls_session not the handler
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 20 Jun 2014 11:23:32 +0000 (12:23 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 20 Jun 2014 11:23:32 +0000 (12:23 +0100)
There's no need for explicit free functions

src/lib/valuepair.c
src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c

index 99732cc..6ecd30f 100644 (file)
@@ -968,6 +968,8 @@ void pairmove(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from)
  * Move pairs of a matching attribute number, vendor number and tag from the
  * the input list to the output list.
  *
+ * @note pairs which are moved have their parent changed to ctx.
+ *
  * @note pairfree should be called on the head of the old list to free unmoved
         attributes (if they're no longer needed).
  *
index 3e44ebe..5e62c79 100644 (file)
@@ -115,24 +115,6 @@ static int eappeap_attach(CONF_SECTION *cs, void **instance)
 }
 
 /*
- *     Free the PEAP per-session data
- */
-static void peap_free(void *p)
-{
-       peap_tunnel_t *t = (peap_tunnel_t *) p;
-
-       if (!t) return;
-
-       pairfree(&t->username);
-       pairfree(&t->state);
-       pairfree(&t->accept_vps);
-       pairfree(&t->soh_reply_vps);
-
-       talloc_free(t);
-}
-
-
-/*
  *     Allocate the PEAP per-session data
  */
 static peap_tunnel_t *peap_alloc(rlm_eap_peap_t *inst, eap_handler_t *handler)
@@ -252,8 +234,7 @@ static int mod_authenticate(void *arg, eap_handler_t *handler)
         *      allocate it if it doesn't already exist.
         */
        if (!tls_session->opaque) {
-               peap = tls_session->opaque = peap_alloc(inst, handler);
-               tls_session->free_opaque = peap_free;
+               peap = tls_session->opaque = peap_alloc(inst, tls_session);
        }
 
        status = eaptls_process(handler);
@@ -312,8 +293,7 @@ static int mod_authenticate(void *arg, eap_handler_t *handler)
         *      allocate it here, if it wasn't already alloacted.
         */
        if (!tls_session->opaque) {
-               tls_session->opaque = peap_alloc(inst, handler);
-               tls_session->free_opaque = peap_free;
+               tls_session->opaque = peap_alloc(inst, tls_session);
        }
 
        /*