Adding the same VP twice is bad mm'k Fixes #809
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 9 Oct 2014 14:32:01 +0000 (10:32 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 9 Oct 2014 14:32:08 +0000 (10:32 -0400)
src/lib/valuepair.c

index 2321fe5..d81d4ea 100644 (file)
@@ -283,11 +283,17 @@ void pairadd(VALUE_PAIR **first, VALUE_PAIR *add)
                *first = add;
                return;
        }
-       for(i = *first; i->next; i = i->next) {
+#ifdef WITH_VERIFY_PTR
+       for (i = *first; i->next; i = i->next) {
                VERIFY_VP(i);
-               if(i == add)
-                       return;
+               /*
+                *      The same VP should never by added multiple times
+                *      to the same list.
+                */
+               fr_assert(i != add);
        }
+#endif
+
        i->next = add;
 }