Skip to content

Commit

Permalink
Fix initialization leak
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Nov 27, 2024
1 parent d5b1989 commit 5a539ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ module *load_text(module *m, const char *src, const char *filename)
p->consulting = false;
p->command = true;
SB(src);
SB_sprintf(src, "forall(%s:retract(('$directive'(initialization(__G_)))), (once(__G_); format('Warning: Initialization goal failed: ~w~n', [__G_])))", p->m->name);
SB_sprintf(src, "forall(%s:retract(('$directive'(initialization(__G_)))), (once(__G_); format('Error: ~w~n', [__G_])))", p->m->name);

if (run(p, SB_cstr(src), false, NULL, 0))
p->m->pl->status = false;
Expand Down Expand Up @@ -2177,7 +2177,7 @@ module *load_fp(module *m, FILE *fp, const char *filename, bool including)
p->command = true;
p->consulting = false;
SB(src);
SB_sprintf(src, "forall(%s:retract(('$directive'(initialization(__G_)))), (once(__G_); format('Warning: Initialization goal failed: ~w~n', [__G_])))", p->m->name);
SB_sprintf(src, "forall(%s:retract(('$directive'(initialization(__G_)))), (once(__G_); format('Error: ~w~n', [__G_])))", p->m->name);

if (run(p, SB_cstr(src), false, NULL, 0))
p->m->pl->status = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/issues/test457.expected
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Warning: Initialization goal failed: main
Error: main
2 changes: 1 addition & 1 deletion tests/tests/test089.expected
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
here
Warning: Initialization goal failed: main
Error: main

0 comments on commit 5a539ad

Please sign in to comment.