From: Alan T. DeKok Date: Sat, 23 Jul 2022 17:40:55 +0000 (-0400) Subject: always free cc->pool, to avoid leaks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba530e490d697c501523deb22e31a5f0209f81a7;p=thirdparty%2Ffreeradius-server.git always free cc->pool, to avoid leaks --- diff --git a/src/lib/server/tmpl_dcursor.c b/src/lib/server/tmpl_dcursor.c index 2135d8cd2df..df7bfbad751 100644 --- a/src/lib/server/tmpl_dcursor.c +++ b/src/lib/server/tmpl_dcursor.c @@ -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); }