]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't record NOOPs
authorAlan T. DeKok <aland@freeradius.org>
Sun, 17 Jul 2022 14:08:27 +0000 (10:08 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 17 Jul 2022 18:08:40 +0000 (14:08 -0400)
src/lib/util/edit.c

index d080395e8cbf77c5b2bea0f95b652d172a10bd42..4c78e389c5ffef166748e72a707e8f85c7b9f77e 100644 (file)
@@ -234,6 +234,15 @@ static int edit_record(fr_edit_list_t *el, fr_edit_op_t op, fr_pair_t *vp, fr_pa
                }
        }
 
+       /*
+        *      Catch NOOPs
+        */
+       if (op == FR_EDIT_CLEAR) {
+               fr_assert(fr_type_is_structural(vp->vp_type));
+
+               if (fr_pair_list_empty(&vp->vp_group)) return 0;
+       }
+
        /*
         *      Search for previous edits.
         *
@@ -571,6 +580,11 @@ int fr_edit_list_free_pair_children(fr_edit_list_t *el, fr_pair_t *vp)
                return 0;
        }
 
+       /*
+        *      No children == do nothing.
+        */
+       if (fr_pair_list_empty(&vp->vp_group)) return 0;
+
        /*
         *      Record the list, even if it's empty.  That way if we
         *      later add children to it, the "undo" operation can