Fix bug causing the free function miss freeing a vector.

This commit is contained in:
Danila Fedorin 2018-02-21 19:00:04 -08:00
parent 6c111f9b67
commit 0541c18a91

View File

@ -149,6 +149,9 @@ libab_result _parse_if(struct parser_state* state, libab_tree** store_into) {
if(_parser_is_type(state, TOKEN_KW_IF)) { if(_parser_is_type(state, TOKEN_KW_IF)) {
result = _parser_construct_node_vec(state, state->current_match, store_into); result = _parser_construct_node_vec(state, state->current_match, store_into);
if(result == LIBAB_SUCCESS) {
(*store_into)->variant = IF;
}
} }
if(result == LIBAB_SUCCESS) { if(result == LIBAB_SUCCESS) {
@ -172,7 +175,6 @@ libab_result _parse_if(struct parser_state* state, libab_tree** store_into) {
} }
if(result == LIBAB_SUCCESS) { if(result == LIBAB_SUCCESS) {
(*store_into)->variant = IF;
if(_parser_is_type(state, TOKEN_KW_ELSE)) { if(_parser_is_type(state, TOKEN_KW_ELSE)) {
_parser_state_step(state); _parser_state_step(state);
result = _parse_expression(state, &else_branch); result = _parse_expression(state, &else_branch);