From: Alan T. DeKok Date: Fri, 12 Nov 2021 21:50:32 +0000 (-0500) Subject: no need to call talloc_free() after aborting the edits X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d13edd65363165ae1dafadb419920fb6bbbf9101;p=thirdparty%2Ffreeradius-server.git no need to call talloc_free() after aborting the edits --- diff --git a/src/lib/util/edit.c b/src/lib/util/edit.c index f0199cb8ad..324e8504e1 100644 --- a/src/lib/util/edit.c +++ b/src/lib/util/edit.c @@ -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 diff --git a/src/lib/util/edit_tests.c b/src/lib/util/edit_tests.c index fba3412ef0..253ebe0e7c 100644 --- a/src/lib/util/edit_tests.c +++ b/src/lib/util/edit_tests.c @@ -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); }