summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 08:58:43 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 09:01:10 +0100
commit0c77cee3abfaf9845090f5b953a4d9b712165fc7 (patch)
tree3edf289db7739e5062f677851ac264f766f41534 /src/modules
parentf57b24b86b213a55564923deaf376a6cf6a77767 (diff)
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.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/model_loaders/ply/evas_model_load_ply.c7
1 files 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,
210void 210void
211evas_model_load_file_ply(Evas_Canvas3D_Mesh *mesh, Eina_File *file) 211evas_model_load_file_ply(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
212{ 212{
213 char *current = NULL, *map = NULL; 213 char *current = NULL, *map = NULL, **split_of_map = NULL;
214 Evas_Model_Load_Save_Header header = { 0, 0, 0, 0, 0, 0 }; 214 Evas_Model_Load_Save_Header header = { 0, 0, 0, 0, 0, 0 };
215 Evas_Model_Load_Save_Data data = { NULL, NULL, NULL, NULL, NULL }; 215 Evas_Model_Load_Save_Data data = { NULL, NULL, NULL, NULL, NULL };
216 Evas_Model_Load_Save_Stride stride = { 0, 0, 0, 0 }; 216 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)
231 return; 231 return;
232 } 232 }
233 233
234 current = eina_str_split(map, "end_header\n", 0)[1]; 234 split_of_map = eina_str_split(map, "end_header\n", 0);
235 current = split_of_map[1];
235 _read_ply_vertex_data(header, &current, data); 236 _read_ply_vertex_data(header, &current, data);
236 _read_ply_indices_data(header, &current, data); 237 _read_ply_indices_data(header, &current, data);
237 evas_model_load_vertex_data_to_mesh(mesh, header, data, &stride); 238 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)
239 evas_model_load_vertex_data_unmap(mesh, 0, header); 240 evas_model_load_vertex_data_unmap(mesh, 0, header);
240 evas_model_load_aabb_add_to_frame(mesh, 0, stride); 241 evas_model_load_aabb_add_to_frame(mesh, 0, stride);
241 242
243 free(split_of_map);
242 if (map) 244 if (map)
243 { 245 {
244 eina_file_map_free(file, map); 246 eina_file_map_free(file, map);
@@ -246,5 +248,4 @@ evas_model_load_file_ply(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
246 } 248 }
247 249
248 evas_model_load_save_data_free(header, &data); 250 evas_model_load_save_data_free(header, &data);
249 free(current);
250} 251}