Free type after retrieving necessary information.

This commit is contained in:
Danila Fedorin 2018-04-24 18:28:31 -07:00
parent 2f6176630f
commit 78d24de152

View File

@ -9,9 +9,9 @@ void libab_value_init(libab_value* value, void* data, libab_ref* type) {
void libab_value_free(libab_value* value) { void libab_value_free(libab_value* value) {
void (*free_function)(void*); void (*free_function)(void*);
libab_parsetype* value_type; libab_parsetype* value_type;
libab_ref_free(&value->type);
value_type = libab_ref_get(&value->type); value_type = libab_ref_get(&value->type);
free_function = value_type->data_u.base->free_function; free_function = value_type->data_u.base->free_function;
libab_ref_free(&value->type);
if (free_function) if (free_function)
free_function(value->data); free_function(value->data);
} }