raster pushed a commit to branch efl-1.22.

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

commit bc90cbfdff54985a2e201743854ed237def0e1c3
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Tue Aug 20 15:15:28 2019 +0100

    edje - handle errors and eina file handles and vpath properly
    
    @fix
---
 src/lib/edje/edje_load.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index fa2f4f7d58..d6cda4277d 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -262,16 +262,18 @@ EAPI Eina_List *
 edje_file_collection_list(const char *file)
 {
    Eina_File *f;
-   Eina_List *lst;
+   Eina_List *lst = NULL;
    char *tmp;
 
    if ((!file) || (!*file)) return NULL;
    tmp = eina_vpath_resolve(file);
    f = eina_file_open(tmp, EINA_FALSE);
+   if (!f) goto err;
 
    lst = edje_mmap_collection_list(f);
 
    eina_file_close(f);
+err:
    free(tmp);
    return lst;
 }
@@ -433,17 +435,21 @@ EAPI Eina_Bool
 edje_file_group_exists(const char *file, const char *glob)
 {
    Eina_File *f;
-   Eina_Bool result;
+   Eina_Bool result = EINA_FALSE;
+   char *tmp;
 
    if ((!file) || (!*file) || (!glob))
      return EINA_FALSE;
 
-   f = eina_file_open(file, EINA_FALSE);
-   if (!f) return EINA_FALSE;
+   tmp = eina_vpath_resolve(file);
+   f = eina_file_open(tmp, EINA_FALSE);
+   if (!f) goto err;
 
    result = edje_mmap_group_exists(f, glob);
 
    eina_file_close(f);
+err:
+   free(tmp);
 
    return result;
 }
@@ -473,20 +479,21 @@ EAPI char *
 edje_file_data_get(const char *file, const char *key)
 {
    Eina_File *f;
-   char *str;
+   char *str = NULL, *tmp;
 
    if (!key) return NULL;
 
+   tmp = eina_vpath_resolve(file);
    f = eina_file_open(file, EINA_FALSE);
    if (!f)
      {
         ERR("File [%s] can not be opened.", file);
-        return NULL;
+        goto err;
      }
-
    str = edje_mmap_data_get(f, key);
-
    eina_file_close(f);
+err:
+   free(tmp);
 
    return str;
 }

-- 


Reply via email to