summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFighter19 <1475802+Fighter19@users.noreply.github.com>2023-05-13 06:13:44 +0200
committerGitHub <noreply@github.com>2023-05-12 21:13:44 -0700
commit529c14bfdc36a36a6f0456391c908dfe3e3612d0 (patch)
tree4bb4f2271e03258f66cfeba8ed6dea0aade92e43
parentfa9e004383690ce2a0de70976cc9b9ef58bf2b03 (diff)
downloadyasm-529c14bfdc36a36a6f0456391c908dfe3e3612d0.tar.gz
Fix badly freed pointer on indented code block after rept (#189)
-rw-r--r--modules/preprocs/gas/gas-preproc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/preprocs/gas/gas-preproc.c b/modules/preprocs/gas/gas-preproc.c
index 8f4c7932..61941bf9 100644
--- a/modules/preprocs/gas/gas-preproc.c
+++ b/modules/preprocs/gas/gas-preproc.c
@@ -979,10 +979,11 @@ static int eval_rept(yasm_preproc_gas *pp, int unused, const char *arg1)
SLIST_INIT(&lines);
while (line) {
- skip_whitespace2(&line);
- if (starts_with(line, ".rept")) {
+ char *line2 = line;
+ skip_whitespace2(&line2);
+ if (starts_with(line2, ".rept")) {
nesting++;
- } else if (starts_with(line, ".endr") && --nesting == 0) {
+ } else if (starts_with(line2, ".endr") && --nesting == 0) {
for (i = 0; i < n; i++) {
buffered_line *current_line;
prev_bline = NULL;