From 529c14bfdc36a36a6f0456391c908dfe3e3612d0 Mon Sep 17 00:00:00 2001 From: Fighter19 <1475802+Fighter19@users.noreply.github.com> Date: Sat, 13 May 2023 06:13:44 +0200 Subject: Fix badly freed pointer on indented code block after rept (#189) --- modules/preprocs/gas/gas-preproc.c | 7 ++++--- 1 file 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; -- cgit v1.2.1