Skip to content

Commit

Permalink
Fix leak with strings, re issue #162
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Apr 23, 2023
1 parent de46237 commit b8af490
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ inline static void set_var(query *q, const cell *c, pl_idx_t c_ctx, cell *v, pl_
cell *c_attrs = is_empty(&e->c) ? e->c.attrs : NULL, *v_attrs = NULL;
pl_idx_t c_attrs_ctx = c_attrs ? e->c.attrs_ctx : 0;

if (c_attrs || (q->cp && (c_ctx < q->st.fp)))
if (c_attrs || (q->cp && (c_ctx < q->st.fp)) || is_managed(v))
add_trail(q, c_ctx, c->var_nbr, c_attrs, c_attrs_ctx);

if (c_attrs && is_var(v)) {
Expand Down Expand Up @@ -220,7 +220,7 @@ inline static void reset_var(query *q, const cell *c, pl_idx_t c_ctx, cell *v, p
const frame *f = GET_FRAME(c_ctx);
slot *e = GET_SLOT(f, c->var_nbr);

if (q->cp && (c_ctx < q->st.fp))
if ((q->cp && (c_ctx < q->st.fp)) || is_managed(v))
add_trail(q, c_ctx, c->var_nbr, NULL, 0);

if (is_structure(v)) {
Expand Down

0 comments on commit b8af490

Please sign in to comment.