diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-09-26 13:12:02 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-09-26 13:12:02 -0700 |
| commit | 77d9007a88a18e0dee08aa9ba93e3aec86375572 (patch) | |
| tree | 5dddf51ce1dfba7fe5272fc024bb839868a789ab /match.c | |
| parent | ee0174001b385944c6a2b3b1fb6ba861613cb4f7 (diff) | |
Refactor of pat_t memory management to use doubly linked lists, and
moving the recursive freeing code from Lua/lbp.c into pattern.c
Diffstat (limited to 'match.c')
| -rw-r--r-- | match.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -531,10 +531,8 @@ static match_t *match(match_ctx_t *ctx, const char *str, pat_t *pat) ctx2.defs = with_def(ctx->defs, m1->pat->args.capture.namelen, m1->pat->args.capture.name, backref); ++m1->refcount; { m2 = match(&ctx2, m1->end, pat->args.multiple.second); - if (!m2) { // No need to keep the backref in memory if it didn't match - free_pat(backref); - backref = NULL; - } + if (!m2) // No need to keep the backref in memory if it didn't match + delete_pat(&backref, false); free_defs(ctx2.defs, ctx->defs); } --m1->refcount; } else { |
