summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parser.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/parser.c b/parser.c
index b756eae..2c4a7d6 100644
--- a/parser.c
+++ b/parser.c
@@ -201,6 +201,7 @@ parse_op(char *str, char *name) {
int
parse_expr(char *str) {
+ int ret = 0;
const char *expr_sep = ": ";
char *ident = NULL;
char *next = NULL;
@@ -217,7 +218,9 @@ parse_expr(char *str) {
op = next + strlen(expr_sep);
- return parse_op(op, ident);
+ ret = parse_op(op, ident);
+ free(ident);
+ return ret;
}
int
@@ -297,12 +300,12 @@ parse_line(char *line) {
}
}
- free(tok);
-
if (match == 0) {
emit_error("invalid token \"%s\"", tok);
+ free(tok);
return 1;
}
+ free(tok);
return 0;
}