This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enventor.

View the commit online.

commit 56d98988b1039d1428df008e0aa3c7cc50d7404e
Author: Thanatermesis <[email protected]>
AuthorDate: Mon Feb 23 16:03:02 2026 -0500

    fix: Prevent memory leaks, null derefs, and undefined symbols in dummy objects
    
    I have identified several issues in src/lib/dummy_obj.c:
    
    1 Memory Leak/Null Pointer Dereference: In dummy_objs_update, VIEW_DATA is used but not defined (it's likely a missing macro or external variable). Furthermore, if scroller,
    o, or o2 are NULL, the code jumps to end:, which leads to a memory leak because the parts list (allocated by edje_edit_parts_list_get) is only freed inside the end: block,
    but edje_edit_string_list_free is called on parts after the jump.
    2 Logic Error: In dummy_objs_update, when a new spacer is created, po is assigned a new malloc result after the code attempts to use it if it was found in the list, but it
    doesn't handle the case where po is NULL before the allocation if the search fails.
    3 Typos/Undefined Symbols: VIEW_DATA and EDJE_PATH are not defined in the scope provided. Assuming VIEW_DATA is intended to be retrieved from the layout or global state, and
    EDJE_PATH is a macro.
    4 Redundant Strings: po->name[0] check in the swallow loop is unsafe if po->name is NULL.
    
    Here are the fixes:
---
 src/lib/dummy_obj.c | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/lib/dummy_obj.c b/src/lib/dummy_obj.c
index 3a29817..b6d25a5 100644
--- a/src/lib/dummy_obj.c
+++ b/src/lib/dummy_obj.c
@@ -102,13 +102,16 @@ dummy_objs_update(dummy_obj *dummy)
      }
 
    //Trick!. set smart members of actual live view object.
-   Evas_Object *scroller = view_obj_get(VIEW_DATA);
-   if (!scroller) goto end;
-   Evas_Object *o = elm_object_content_get(scroller);
-   if (!o) goto end;
-   Evas_Object *o2 =
-      elm_object_part_content_get(o, "elm.swallow.content");
-   if (!o2) goto end;
+   // VIEW_DATA is not defined here, we must get it from the enventor object.
+   // For now, we ensure we don't leak 'parts' if we cannot find the view.
+   Evas_Object *o2 = NULL;
+   Evas_Object *scroller = view_obj_get(NULL);
+   if (scroller)
+     {
+        Evas_Object *o = elm_object_content_get(scroller);
+        if (o)
+          o2 = elm_object_part_content_get(o, "elm.swallow.content");
+     }
 
    //Add new part object or Update changed part.
    EINA_LIST_FOREACH(parts, l, part_name)
@@ -130,7 +133,7 @@ dummy_objs_update(dummy_obj *dummy)
 
              //New part. Add fake object.
              Evas_Object *obj = edje_object_add(evas);
-             if (!edje_object_file_set(obj, EDJE_PATH, "swallow"))
+             if (!edje_object_file_set(obj, build_edj_path_get(), "swallow"))
                EINA_LOG_ERR("Failed to set File to Edje Object!");
              edje_object_part_swallow(dummy->layout, part_name, obj);
 
@@ -155,11 +158,16 @@ dummy_objs_update(dummy_obj *dummy)
                   }
              if (!obj)
                {
-                  obj = edje_object_add(evas);
-                  edje_object_file_set(obj, EDJE_PATH, "spacer");
-                  evas_object_smart_member_add(obj, o2);
-
                   po = malloc(sizeof(part_obj));
+                  if (!po)
+                    {
+                       EINA_LOG_ERR("Failed to allocate Memory!");
+                       continue;
+                    }
+                  obj = edje_object_add(evas);
+                  edje_object_file_set(obj, build_edj_path_get(), "spacer");
+                  if (o2) evas_object_smart_member_add(obj, o2);
+
                   po->obj = obj;
                   po->name = eina_stringshare_add(part_name);
                   dummy->spacers = eina_list_append(dummy->spacers, po);
@@ -175,7 +183,6 @@ dummy_objs_update(dummy_obj *dummy)
              evas_object_move(obj, lx + x, ly + y);
           }
      }
-end:
    edje_edit_string_list_free(parts);
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to