]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
better fix for #1456
authorAlan T. DeKok <aland@freeradius.org>
Tue, 15 Dec 2015 21:50:40 +0000 (16:50 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 15 Dec 2015 21:50:40 +0000 (16:50 -0500)
src/lib/cursor.c

index 89cf34c2d93a0f9808cb4072f671057772f49284..ae88ebe75bd20622450c701a543a8940a89eb268 100644 (file)
@@ -392,6 +392,7 @@ VALUE_PAIR *fr_cursor_remove(vp_cursor_t *cursor)
                *(cursor->first) = vp->next;
                cursor->current = vp->next;
                cursor->next = vp->next ? vp->next->next : NULL;
+               before = NULL;
                goto fixup;
        }
 
@@ -413,9 +414,10 @@ fixup:
        vp->next = NULL;                        /* limit scope of fr_pair_list_free() */
 
        /*
-        *      Fixup cursor->found if we removed the VP it was referring to
+        *      Fixup cursor->found if we removed the VP it was referring to,
+        *      and point to the previous one.
         */
-       if (vp == cursor->found) cursor->found = cursor->current;
+       if (vp == cursor->found) cursor->found = before;
 
        /*
         *      Fixup cursor->last if we removed the VP it was referring to