diff options
| author | mbkma <[email protected]> | 2026-03-11 22:59:56 +0100 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2026-03-12 12:27:17 -0400 |
| commit | b8126bfc033da43ad332e62f1c4ff6ec2662998e (patch) | |
| tree | a12525469c563005867466a7768ee5ed877ae765 /src/parser.c | |
| parent | aeaa5450f8fa4e70aeea00eed02191106fe26705 (diff) | |
| download | mate-calc-b8126bfc033da43ad332e62f1c4ff6ec2662998e.tar.bz2 mate-calc-b8126bfc033da43ad332e62f1c4ff6ec2662998e.tar.xz | |
Diffstat (limited to 'src/parser.c')
| -rw-r--r-- | src/parser.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser.c b/src/parser.c index c9d711b..6aeba9e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -238,6 +238,7 @@ p_create_parser(const gchar* input, MPEquationOptions* options) state->options = options; state->error = 0; state->error_token = NULL; + state->ret = mp_new(); return state; } @@ -276,7 +277,6 @@ p_parse(ParserState* state) ans = (MPNumber *) (*(state->root->evaluate))(state->root); if(ans) { - state->ret = mp_new(); mp_set_from_mp(ans, &state->ret); mp_free(ans); return PARSER_ERR_NONE; @@ -294,6 +294,8 @@ p_destroy_parser(ParserState* state) p_destroy_all_nodes(state->root); } l_destroy_lexer(state->lexer); + mp_clear(&state->ret); + free(state->error_token); free(state); } |
