]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Always free the cc->pool
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 1 Dec 2020 18:57:05 +0000 (11:57 -0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 1 Dec 2020 18:58:48 +0000 (11:58 -0700)
src/lib/server/tmpl_eval.c

index b0cfb6706387f16dd2bd1b773255df5f0d1f10e3..e56b57c8a258dcfc52dff7dfd830f6b5970c41e1 100644 (file)
@@ -1291,12 +1291,16 @@ fr_pair_t *tmpl_cursor_init(int *err, TALLOC_CTX *ctx, tmpl_cursor_ctx_t *cc,
  */
 void tmpl_cursor_clear(tmpl_cursor_ctx_t *cc)
 {
+       /*
+        *      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);
-
-       TALLOC_FREE(cc->pool);
 }
 
 /** Copy pairs matching a #tmpl_t in the current #request_t