evas vg: fix a memory leak.

if a vector file data is not sharable,
it must close the file immediately when
the instance is destroyed.
This commit is contained in:
Hermet Park 2019-01-22 14:10:34 +09:00
parent c929cb2c78
commit 61384ffda8
1 changed files with 14 additions and 8 deletions

View File

@ -150,7 +150,12 @@ _evas_cache_vg_entry_free_cb(void *data)
if (vg_entry->vfd)
{
vg_entry->vfd->ref--;
if (vg_entry->vfd->ref <= 0 && !vg_entry->vfd->no_share)
if (vg_entry->vfd->ref <= 0)
{
if (vg_entry->vfd->no_share)
vg_entry->vfd->loader->file_close(vg_entry->vfd);
else
{
Eina_Strbuf *hash_key = eina_strbuf_new();
eina_strbuf_append_printf(hash_key, "%s/%s",
@ -161,6 +166,7 @@ _evas_cache_vg_entry_free_cb(void *data)
eina_strbuf_free(hash_key);
}
}
}
eina_stringshare_del(vg_entry->key);
free(vg_entry->hash_key);