From 8f09cf9dd31c5082b54fd11e934082b1bfb898e3 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 24 Mar 2020 15:19:23 +0100 Subject: [PATCH] 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 Differential Revision: https://phab.enlightenment.org/D11577 --- src/lib/eo/eo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index f7691e353d..e0b2d464fb 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -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)