eo: only really copy when there is content

otherwise we are allocating a 0 sized memory element, which is
pointless.
ASAN would report a 0 sized allocated but not freed element as a leak.

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D11577
This commit is contained in:
Marcel Hollerbach 2020-03-24 15:19:23 +01:00
parent 9762d75dc4
commit 8f09cf9dd3
1 changed files with 4 additions and 1 deletions

View File

@ -285,7 +285,10 @@ _vtable_merge_defined_api(Eo_Vtable *dest, const Eo_Vtable *src, Eina_Bool *hitm
if (!hitmap[i])
{
const Eo_Vtable_Node node = dest->chain[i];
_vtable_copy_node(&dest->chain[i], &node); //we copy what we have, and overwrite in the later for loop
if (!node.count)
_vtable_insert_empty_funcs(dest, i);
else
_vtable_copy_node(&dest->chain[i], &node); //we copy what we have, and overwrite in the later for loop
hitmap[i] = EINA_TRUE;
}
for (int j = 0; j < src->chain[i].count; ++j)