From 0c77cee3abfaf9845090f5b953a4d9b712165fc7 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 14 Feb 2020 08:58:43 +0100 Subject: [PATCH] evas_model_loader: fix 8f3bef248bb0002cbbd40052eb759d1b2ae29ce9 The commit fixed a mem leak with freeing one element in the array, which was never going to work, as only the array is a pointer you can allocate. This could have been discovered by simply running ninja test. --- src/modules/evas/model_loaders/ply/evas_model_load_ply.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/evas/model_loaders/ply/evas_model_load_ply.c b/src/modules/evas/model_loaders/ply/evas_model_load_ply.c index 20819f5fde..51b3b419ab 100644 --- a/src/modules/evas/model_loaders/ply/evas_model_load_ply.c +++ b/src/modules/evas/model_loaders/ply/evas_model_load_ply.c @@ -210,7 +210,7 @@ _read_ply_indices_data(Evas_Model_Load_Save_Header header, void evas_model_load_file_ply(Evas_Canvas3D_Mesh *mesh, Eina_File *file) { - char *current = NULL, *map = NULL; + char *current = NULL, *map = NULL, **split_of_map = NULL; Evas_Model_Load_Save_Header header = { 0, 0, 0, 0, 0, 0 }; Evas_Model_Load_Save_Data data = { NULL, NULL, NULL, NULL, NULL }; Evas_Model_Load_Save_Stride stride = { 0, 0, 0, 0 }; @@ -231,7 +231,8 @@ evas_model_load_file_ply(Evas_Canvas3D_Mesh *mesh, Eina_File *file) return; } - current = eina_str_split(map, "end_header\n", 0)[1]; + split_of_map = eina_str_split(map, "end_header\n", 0); + current = split_of_map[1]; _read_ply_vertex_data(header, ¤t, data); _read_ply_indices_data(header, ¤t, data); evas_model_load_vertex_data_to_mesh(mesh, header, data, &stride); @@ -239,6 +240,7 @@ evas_model_load_file_ply(Evas_Canvas3D_Mesh *mesh, Eina_File *file) evas_model_load_vertex_data_unmap(mesh, 0, header); evas_model_load_aabb_add_to_frame(mesh, 0, stride); + free(split_of_map); if (map) { eina_file_map_free(file, map); @@ -246,5 +248,4 @@ evas_model_load_file_ply(Evas_Canvas3D_Mesh *mesh, Eina_File *file) } evas_model_load_save_data_free(header, &data); - free(current); }