aboutsummaryrefslogtreecommitdiff
path: root/src/sc_interp.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-03 21:27:07 +0100
committerThomas White <taw@physics.org>2018-03-03 21:27:07 +0100
commit36a7d5436484f81bdd842aa2b415d1213c204d82 (patch)
tree3dbd0364f3c9876309a6a993fc16c6039688613f /src/sc_interp.c
parent5240c17e9e7823f8e2b53a1ce61a6a6b4681ad8b (diff)
Fix a memory bug in exec_macro
Diffstat (limited to 'src/sc_interp.c')
-rw-r--r--src/sc_interp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c
index 51849d5..d2db5bf 100644
--- a/src/sc_interp.c
+++ b/src/sc_interp.c
@@ -1073,9 +1073,9 @@ static void exec_macro(SCBlock *bl, SCInterpreter *scin, SCBlock *child)
sc_interp_save(scin);
scin->state[scin->j].macro_real_block = bl;
scin->state[scin->j].macro_contents = child;
- sc_interp_add_blocks(scin, st->macros[i].bl);
+ sc_interp_add_blocks(scin, scin->state[scin->j].macros[i].bl);
sc_interp_restore(scin);
- break;
+ break; /* Stop iterating, because "st" is now invalid */
}
}
}