summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-20 21:55:42 -0400
committerIan Moffett <ian@osmora.org>2025-07-20 21:57:15 -0400
commit60ceb932fd0889690fef6883361eaf81cbf7ffae (patch)
tree97580c71c1b81edffc52e31491dafc6710c0781b /usr.bin
parent869f0128b4b71fc3978fdc66ebae802aa3537a95 (diff)
oasm: lex: Free tokenstr on error
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/oasm/lex.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/usr.bin/oasm/lex.c b/usr.bin/oasm/lex.c
index 194f09a..c2a7a1f 100644
--- a/usr.bin/oasm/lex.c
+++ b/usr.bin/oasm/lex.c
@@ -284,7 +284,6 @@ lex_tok(struct oasm_state *state, struct oasm_token *ttp)
if ((tok = token_arith(p)) != TT_UNKNOWN) {
ttp->type = tok;
ttp->raw = p;
- lex_try_free(p);
return 0;
}
@@ -293,7 +292,6 @@ lex_tok(struct oasm_state *state, struct oasm_token *ttp)
ttp->is_reg = 1;
ttp->type = tok;
ttp->raw = p;
- lex_try_free(p);
return 0;
}
@@ -301,10 +299,10 @@ lex_tok(struct oasm_state *state, struct oasm_token *ttp)
if ((tok = token_operand(p)) != TT_UNKNOWN) {
ttp->type = tok;
ttp->raw = p;
- lex_try_free(p);
return 0;
}
oasm_err("bad token \"%s\"\n", p);
+ lex_try_free(p);
return -1;
}