cedric pushed a commit to branch master.

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

commit 8272d1492796657978c5591971768d37d4e15a7e
Author: jiin.moon <jiin.m...@samsung.com>
Date:   Tue Sep 20 14:22:33 2016 -0700

    eet: fix memory leak
    
    Summary:
    If ef is null, have to return before _set_material_to_eet_file_from_mesh 
api.
    New momory will be allocated in the api.
    
    Subscribers: cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D4305
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/modules/evas/model_savers/eet/evas_model_save_eet.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/modules/evas/model_savers/eet/evas_model_save_eet.c 
b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
index a5878dc..c752dd3 100644
--- a/src/modules/evas/model_savers/eet/evas_model_save_eet.c
+++ b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
@@ -156,6 +156,14 @@ evas_model_save_file_eet(const Evas_Canvas3D_Mesh *mesh,
    eet_init();
 
    ef = eet_open(file, EET_FILE_MODE_WRITE);
+   if (ef == NULL)
+     {
+        ERR("Opening of file is failed.");
+        free(eet_mesh);
+        free(eet_header);
+        eet_shutdown();
+        return;
+     }
 
    _file_descriptor = _evas_canvas3d_eet_file_get();
 
@@ -181,15 +189,6 @@ evas_model_save_file_eet(const Evas_Canvas3D_Mesh *mesh,
    _set_material_to_eet_file_from_mesh(eet_mesh, eet_header, f);
    _set_frame_to_eet_file_from_mesh(eet_mesh);
 
-   if (ef == NULL)
-     {
-        ERR("Opening of file is failed.");
-        free(eet_mesh);
-        free(eet_header);
-
-        goto on_error;
-     }
-
    eet_file->mesh = eet_mesh;
    eet_file->header = eet_header;
 

-- 


Reply via email to