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 <cedric@osg.samsung.com>
This commit is contained in:
jiin.moon 2016-09-20 14:22:33 -07:00 committed by Cedric BAIL
parent b437bfb3fe
commit 8272d14927
1 changed files with 8 additions and 9 deletions

View File

@ -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;