eolian: fix eina hash usage so it doesn't consume all your memory
This makes sure items are checked before being added, so that eina hash doesn't get confused, add each item thousands of times and run out of memory.
This commit is contained in:
parent
665b88204c
commit
26f0c56faf
|
@ -2256,7 +2256,7 @@ eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot
|
|||
|
||||
if (ret)
|
||||
{
|
||||
if (parent != ret)
|
||||
if ((parent != ret) && !eina_hash_find(parent->children, filename))
|
||||
eina_hash_add(parent->children, filename, ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -706,8 +706,12 @@ static Eina_Bool
|
|||
_merge_unit_cb(const Eina_Hash *hash EINA_UNUSED,
|
||||
const void *key, void *data, void *fdata)
|
||||
{
|
||||
if (eina_hash_add((Eina_Hash *)fdata, key, data))
|
||||
eolian_object_ref((Eolian_Object *)data);
|
||||
Eina_Hash *dest = fdata;
|
||||
if (!eina_hash_find(dest, key))
|
||||
{
|
||||
eina_hash_add(dest, key, data);
|
||||
eolian_object_ref((Eolian_Object *)data);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -744,6 +748,7 @@ _merge_units_cb(const Eina_Hash *hash EINA_UNUSED,
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_merge_units(Eolian_Unit *unit)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue