Ensure reference is always initialized.

This commit is contained in:
Danila Fedorin 2018-04-22 21:24:43 -07:00
parent ac26c4dbd0
commit 43a22d7492
2 changed files with 6 additions and 1 deletions

View File

@ -324,9 +324,13 @@ libab_result _parse_type(struct parser_state* state, libab_ref* into) {
result = libab_ref_new(into, store_into, _parse_type_free);
if (result != LIBAB_SUCCESS) {
libab_parsetype_free(store_into);
}
}
if(result != LIBAB_SUCCESS) {
libab_ref_null(into);
}
}
return result;
}

View File

@ -114,6 +114,7 @@ libab_result libab_instantiate_basetype(libab_basetype* to_instantiate,
}
if(result != LIBAB_SUCCESS) {
libab_ref_null(into);
free(parsetype);
}