]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
always free cc->pool, to avoid leaks
authorAlan T. DeKok <aland@freeradius.org>
Sat, 23 Jul 2022 17:40:55 +0000 (13:40 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 23 Jul 2022 23:47:21 +0000 (19:47 -0400)
src/lib/server/tmpl_dcursor.c

index 2135d8cd2dfb07a1c9931d399ac973132d12f99b..df7bfbad751935052a072eb4b3c1b909ca434a53 100644 (file)
@@ -427,16 +427,16 @@ fr_pair_t *tmpl_dcursor_init(int *err, TALLOC_CTX *ctx, tmpl_dcursor_ctx_t *cc,
  */
 void tmpl_dursor_clear(tmpl_dcursor_ctx_t *cc)
 {
-       if (!fr_dlist_num_elements(&cc->nested)) return;/* Help simplify dealing with unused cursor ctxs */
-
-       fr_dlist_remove(&cc->nested, &cc->leaf);        /* Noop if leaf isn't inserted */
-       fr_dlist_talloc_free(&cc->nested);
-
        /*
         *      Always free the pool because it's allocated when
         *      any nested ctxs are used.
         */
        TALLOC_FREE(cc->pool);
+
+       if (!fr_dlist_num_elements(&cc->nested)) return;/* Help simplify dealing with unused cursor ctxs */
+
+       fr_dlist_remove(&cc->nested, &cc->leaf);        /* Noop if leaf isn't inserted */
+       fr_dlist_talloc_free(&cc->nested);
 }