forked from enlightenment/efl
evas_smart: Add a check for zero size before malloc
Summary: Size may be zero while allocating interfaces private data, when NULL is passed in EVAS_SMART_SUBCLASS_IFACE_NEW for ifaces argument. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free(). It is implementation dependent. This case would be likely to occur in case of smart classes with no interfaces. @fix Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com> Reviewers: raster, Hermet, tasn, cedric Subscribers: SanghyeonLee, sachin.dev, singh.amitesh, cedric Differential Revision: https://phab.enlightenment.org/D2679
This commit is contained in:
parent
8f0b8a9060
commit
a1545ec314
|
@ -496,6 +496,8 @@ _evas_smart_class_ifaces_private_data_alloc(Evas_Object *eo_obj,
|
|||
}
|
||||
}
|
||||
|
||||
if (!s->interfaces.size && !total_priv_sz) return;
|
||||
|
||||
obj = eo_data_scope_get(eo_obj, MY_CLASS);
|
||||
obj->interface_privates = malloc(s->interfaces.size * sizeof(void *) + total_priv_sz);
|
||||
if (!obj->interface_privates)
|
||||
|
|
Loading…
Reference in New Issue