aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-15 16:45:23 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-15 16:45:23 +0100
commit2c59abc878a692aafdc69897982eaeb0a147624c (patch)
tree274a4e8161ba2f5bf871d8c7f9911637114ef367
parenteolian: make sure dtors are always run correctly (diff)
downloadefl-2c59abc878a692aafdc69897982eaeb0a147624c.tar.gz
eolian: fix minor memory leaks
-rw-r--r--src/lib/eolian/database_type.c1
-rw-r--r--src/lib/eolian/eolian_database.c20
2 files changed, 15 insertions, 6 deletions
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index 597015944f..28626fd636 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -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
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 1a8b9ab402..4e971712f6 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -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);