From 98e332ea671108d34b4b2fd2cde7ba9d478b3e27 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 1 Jan 2014 21:39:23 +0000 Subject: [PATCH] parser: fix error reporting --- parser.y | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parser.y b/parser.y index e3b9ee9..54c6077 100644 --- a/parser.y +++ b/parser.y @@ -58,7 +58,7 @@ struct jp_opcode { struct jp_state { struct jp_opcode *pool; struct jp_opcode *path; - const char *error; + char *error; char str_quote; char str_buf[128]; char *str_ptr; @@ -167,7 +167,7 @@ unary_exp void yyerror(struct jp_state *s, const char *msg) { - s->error = msg; + s->error = strdup(msg); } static struct jp_opcode * @@ -253,5 +253,8 @@ jp_free(struct jp_state *s) op = tmp; } + if (s->error) + free(s->error); + free(s); } -- 2.25.1