tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a1545ec314776d40f08486221aca37eb8073176e

commit a1545ec314776d40f08486221aca37eb8073176e
Author: Vaibhav Gupta <g.vaibh...@samsung.com>
Date:   Fri Jun 12 09:47:13 2015 +0100

    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.vaibh...@samsung.com>
    
    Reviewers: raster, Hermet, tasn, cedric
    
    Subscribers: SanghyeonLee, sachin.dev, singh.amitesh, cedric
    
    Differential Revision: https://phab.enlightenment.org/D2679
---
 src/lib/evas/canvas/evas_object_smart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lib/evas/canvas/evas_object_smart.c 
b/src/lib/evas/canvas/evas_object_smart.c
index 252e71a..27fca2b 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -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)

-- 


Reply via email to