Modifying a list (head) should propagate the modified list head back.
Choose one of the following patches. I do not know with one has which impact.
I tested the first one. No more leaks on reload.

------------------------------------------------------------------------
--- src/main/files.c.orig       Tue Jan 22 16:43:43 2002
+++ src/main/files.c    Tue Feb  5 13:15:03 2002
@@ -69,7 +69,7 @@
  *     If Password or Crypt-Password is set, but there is no
  *     Auth-Type, add one (kludge!).
  */
-static void auth_type_fixup(VALUE_PAIR *check)
+static void auth_type_fixup(VALUE_PAIR **check)
 {
        VALUE_PAIR *vp;
        VALUE_PAIR *c = NULL;
@@ -79,7 +79,7 @@
         *      See if a password is present. Return right away
         *      if we see Auth-Type.
         */
-       for (vp = check; vp; vp = vp->next) {
+       for (vp = *check; vp; vp = vp->next) {
                if (vp->attribute == PW_AUTHTYPE)
                        return;
                if (vp->attribute == PW_PASSWORD) {
@@ -106,14 +106,10 @@
        vp->lvalue = n;
        vp->operator = T_OP_ADD;
 
-#if 0
-       vp->next = c->next;
-       c->next = vp;
-#endif
-       vp->next = check;
-       check = vp;
+       vp->next = *check;
+       *check = vp;
 
-       for(vp = check; vp; vp = vp->next) {
+       for(vp = *check; vp; vp = vp->next) {
                DEBUG2("  auth_type_fixup: %s [%d]", vp->name, vp->attribute);
        }
 
@@ -285,7 +281,7 @@
                                 */
                                t = rad_malloc(sizeof(PAIR_LIST));
 
-                               auth_type_fixup(check_tmp);
+                               auth_type_fixup(&check_tmp);
                                memset(t, 0, sizeof(*t));
                                t->name = strdup(entry);
                                t->check = check_tmp;
------------------------------------------------------------------------
--- src/main/files.c.orig       Tue Jan 22 16:43:43 2002
+++ src/main/files.c    Tue Feb  5 13:58:58 2002
@@ -106,12 +106,8 @@
        vp->lvalue = n;
        vp->operator = T_OP_ADD;
 
-#if 0
        vp->next = c->next;
        c->next = vp;
-#endif
-       vp->next = check;
-       check = vp;
 
        for(vp = check; vp; vp = vp->next) {
                DEBUG2("  auth_type_fixup: %s [%d]", vp->name, vp->attribute);
------------------------------------------------------------------------

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to