eolian: fix minor memory leaks

This commit is contained in:
Daniel Kolesa 2018-03-15 16:45:23 +01:00
parent edc73c4c4c
commit 2c59abc878
2 changed files with 15 additions and 6 deletions

View File

@ -105,6 +105,7 @@ _append_name(const Eolian_Object *obj, Eina_Strbuf *buf)
eina_strbuf_append_char(buf, '_');
}
eina_strbuf_append(buf, eolian_object_short_name_get(obj));
eina_iterator_free(itr);
}
void

View File

@ -534,13 +534,11 @@ database_unit_init(Eolian_State *state, Eolian_Unit *unit, const char *file)
unit->objects = eina_hash_stringshared_new(NULL);
}
void
database_unit_del(Eolian_Unit *unit)
static void
_unit_contents_del(Eolian_Unit *unit)
{
if (!unit)
return;
eina_stringshare_del(unit->file);
eina_hash_free(unit->children);
eina_hash_free(unit->classes);
eina_hash_free(unit->globals);
eina_hash_free(unit->constants);
@ -550,6 +548,16 @@ database_unit_del(Eolian_Unit *unit)
eina_hash_free(unit->objects);
}
void
database_unit_del(Eolian_Unit *unit)
{
if (!unit)
return;
_unit_contents_del(unit);
free(unit);
}
static void
_hashlist_free(void *data)
{
@ -588,7 +596,7 @@ eolian_state_free(Eolian_State *state)
if (!state)
return;
database_unit_del(&state->unit);
_unit_contents_del(&state->unit);
eina_hash_free(state->filenames_eo);
eina_hash_free(state->filenames_eot);