diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-01-01 21:39:23 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-01-01 21:53:09 +0000 |
commit | 98e332ea671108d34b4b2fd2cde7ba9d478b3e27 (patch) | |
tree | 3b22a840d0f52fbf0545cfb8b338f56a9bbd1211 | |
parent | c95f8d8ed4035cdbebfdfb1ff0c94e3958f3ebb9 (diff) | |
download | jsonpath-98e332ea671108d34b4b2fd2cde7ba9d478b3e27.tar.gz |
parser: fix error reporting
-rw-r--r-- | parser.y | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); } |