]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
no need to call talloc_free() after aborting the edits
authorAlan T. DeKok <aland@freeradius.org>
Fri, 12 Nov 2021 21:50:32 +0000 (16:50 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 12 Nov 2021 23:37:11 +0000 (18:37 -0500)
src/lib/util/edit.c
src/lib/util/edit_tests.c

index f0199cb8adcdb823a4d3070998d8c5b79a19fe62..324e8504e184420c2f8f258a09d88cdc6893e407 100644 (file)
@@ -133,7 +133,7 @@ static int edit_undo(fr_edit_t *e)
  *  After this call, the input list(s) are unchanged from before any
  *  edits were made.
  *
- *  the caller still has to call talloc_free(el);
+ *  the caller does not have to call talloc_free(el);
  */
 void fr_edit_list_abort(fr_edit_list_t *el)
 {
@@ -155,6 +155,8 @@ void fr_edit_list_abort(fr_edit_list_t *el)
                 *      faster than doing it incrementally.
                 */
        };
+
+       talloc_free(el);
 }
 
 /** Record one particular edit
index fba3412ef04589739fb9a995d11d2abca57deacc..253ebe0e7c115317f2fc3cc404fb9fc0a518e9d3 100644 (file)
@@ -177,8 +177,6 @@ static void test_pair_delete_head_abort(void)
         */
        fr_edit_list_abort(el);
 
-       talloc_free(el);
-
        expect3(&local_pairs);
 }
 
@@ -258,8 +256,6 @@ static void test_pair_delete_middle_abort(void)
         */
        fr_edit_list_abort(el);
 
-       talloc_free(el);
-
        expect3(&local_pairs);
 }
 
@@ -349,8 +345,6 @@ static void test_pair_delete_multiple_abort(void)
         */
        fr_edit_list_abort(el);
 
-       talloc_free(el);
-
        expect3(&local_pairs);
 }
 
@@ -419,8 +413,6 @@ static void test_pair_edit_value_abort(void)
         */
        fr_edit_list_abort(el);
 
-       talloc_free(el);
-
        vp = fr_pair_list_head(&local_pairs);
        TEST_CHECK(vp->da == fr_dict_attr_test_uint32);
        TEST_CHECK(vp->vp_uint32 == 0);
@@ -489,7 +481,6 @@ static void test_pair_insert_after_head_abort(void)
         *      Abort the edit
         */
        fr_edit_list_abort(el);
-       talloc_free(el);
 
        expect3(&local_pairs);
 }
@@ -559,7 +550,6 @@ static void test_pair_insert_after_middle_abort(void)
         *      Abort the edit
         */
        fr_edit_list_abort(el);
-       talloc_free(el);
 
        expect3(&local_pairs);
 }