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 b2256812e5a529141b963e23ee9109d6bd794960
Author: Thanatermesis <[email protected]>
AuthorDate: Mon Feb 23 16:04:20 2026 -0500
fix: Improve edj_mgr robustness with null checks and proper init handling
I have identified a few issues in src/lib/edj_mgr.c:
1 Memory Leak/Undefined Behavior: In edj_mgr_init, if elm_layout_add fails (returns NULL), the code continues and tries to use it. Also, if memory allocation for em fails, it
returns but doesn't handle the failure at the call site (though the global g_em remains NULL).
2 Safety Checks: Several functions lack checks for g_em being NULL, which could lead to crashes if called before init or after term.
3 Logical Consistency: In edj_mgr_view_del, the logic matches view_del_cb but is slightly duplicated; ensuring em->edj is cleared if it matches the deleted view is important
for safety.
Here are the fixes:
---
src/lib/edj_mgr.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/lib/edj_mgr.c b/src/lib/edj_mgr.c
index 9ed1649..f94493f 100644
--- a/src/lib/edj_mgr.c
+++ b/src/lib/edj_mgr.c
@@ -83,15 +83,22 @@ edj_mgr_init(Enventor_Object *enventor)
g_em = em;
Evas_Object *layout = elm_layout_add(enventor);
+ if (!layout)
+ {
+ free(em);
+ return;
+ }
elm_layout_file_set(layout, EDJE_PATH, "viewer_layout");
em->enventor = enventor;
em->layout = layout;
+ g_em = em;
}
void
edj_mgr_term(void)
{
edj_mgr *em = g_em;
+ if (!em) return;
edj_mgr_clear();
evas_object_del(em->layout);
@@ -121,9 +128,12 @@ void
edj_mgr_view_del(view_data *vd)
{
edj_mgr *em = g_em;
+ if (!em) return;
edj_data *edj = view_data_get(vd);
+ if (!edj) return;
em->edjs = eina_list_remove(em->edjs, edj);
ecore_timer_del(edj->timer);
+ if (em->edj == edj) em->edj = NULL;
view_term(vd);
free(edj);
}
@@ -209,6 +219,7 @@ Evas_Object *
edj_mgr_obj_get(void)
{
edj_mgr *em = g_em;
+ if (!em) return NULL;
return em->layout;
}
@@ -216,6 +227,7 @@ void
edj_mgr_reload_need_set(Eina_Bool reload)
{
edj_mgr *em = g_em;
+ if (!em) return;
em->reload_need = reload;
}
@@ -223,6 +235,7 @@ Eina_Bool
edj_mgr_reload_need_get(void)
{
edj_mgr *em = g_em;
+ if (!em) return EINA_FALSE;
return em->reload_need;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.