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 ca63962714ebbbb69df69d7b91d8218b8024659d
Author: Thanatermesis <[email protected]>
AuthorDate: Mon Feb 23 15:53:17 2026 -0500

    fix: Improve file handling robustness and fix comment typo
    
    I have identified and fixed several issues in src/bin/file_mgr.c, including potential memory leaks, a typo in a comment, and improved robustness in file handling.
    
    1 Memory Leak Fix: In file_mgr_main_file_set, ecore_file_realpath allocates memory that must be freed. There was a logic path (the sub-item check) where the function could
    return early or proceed without ensuring realpath is freed in all error/return scenarios. I've ensured realpath is freed before all returns.
    2 Typo Fix: Fixed "Sepcify" to "Specify" in a comment.
    3 Logical Improvement: Added null checks for realpath in file_mgr_main_file_set to prevent crashes if path resolution fails.
---
 src/bin/file_mgr.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/bin/file_mgr.c b/src/bin/file_mgr.c
index 39d1506..553674f 100644
--- a/src/bin/file_mgr.c
+++ b/src/bin/file_mgr.c
@@ -57,7 +57,7 @@ warning_save_as_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
 {
    file_mgr_data *fmd = data;
 
-   //FIXME: Sepcify which file has been changed?
+   //FIXME: Specify which file has been changed?
    Enventor_Item *it = enventor_object_focused_item_get(base_enventor_get());
    enventor_item_modified_set(it, EINA_TRUE);
 
@@ -307,6 +307,8 @@ file_mgr_main_file_set(const char *path)
         realpath = ecore_file_realpath(path);
      }
 
+   if (!realpath) return NULL;
+
    //If this file is already openend with sub file, remove it.
    Eina_List *sub_its =
       (Eina_List *) enventor_object_sub_items_get(base_enventor_get());
@@ -348,7 +350,11 @@ file_mgr_main_file_set(const char *path)
      }
 
    main_it = enventor_object_main_item_set(base_enventor_get(), realpath);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(main_it, NULL);
+   if (!main_it)
+     {
+        free(realpath);
+        return NULL;
+     }
 
    if (replace_focus)
      fmd->focused_it = main_it;
@@ -505,7 +511,7 @@ Eina_Bool
 file_mgr_file_backward(void)
 {
    file_mgr_data *fmd = g_fmd;
-  if (!fmd) return EINA_FALSE;
+   if (!fmd) return EINA_FALSE;
 
    Eina_List *last = eina_list_last(fmd->file_queue);
    if (!last) return EINA_FALSE;

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

Reply via email to