star-cad

Geometric operators for computer-aided design
git clone git://git.meso-star.fr/star-cad.git
Log | Files | Refs | README | LICENSE

commit 5a7eb74e05959dae7b4550bc29649393d6957938
parent 08b92bd511a6f08b4d3623e9f1a1c587de678175
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Thu, 12 Jun 2025 16:35:32 +0200

Fix memleaks in test_api

Diffstat:
Msrc/test_api.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/test_api.c b/src/test_api.c @@ -192,7 +192,10 @@ main(int argc, char* argv[]) BAD(scad_geometries_common_boundaries(NULL, &geom1, 1, &geom2, 1, &geom_array, NULL)); BAD(scad_geometries_common_boundaries(NULL, &geom1, 1, &geom2, 1, NULL, &c)); OK(scad_geometries_common_boundaries(NULL, &geom1, 1, &geom2, 1, &geom_array, &c)); - OK(scad_geometry_ref_put(geom)); + for(i = 0; i < c; i++) { + OK(scad_geometry_ref_put(geom_array[i])); + } + MEM_RM(&allocator, geom_array); BAD(scad_geometries_partition(NULL, 2, 1, out_geoms)); BAD(scad_geometries_partition(geoms, 0, 1, out_geoms)); @@ -205,7 +208,10 @@ main(int argc, char* argv[]) BAD(scad_geometries_boundary(NULL, &geom1, 1, NULL, &c)); BAD(scad_geometries_boundary(NULL, NULL, 0, &geom_array, NULL)); OK(scad_geometries_boundary(NULL, &geom1, 1, &geom_array, &c)); - OK(scad_geometry_ref_put(geom)); + for(i = 0; i < c; i++) { + OK(scad_geometry_ref_put(geom_array[i])); + } + MEM_RM(&allocator, geom_array); BAD(scad_geometry_copy(NULL, NULL, &geom)); BAD(scad_geometry_copy(geom1, NULL, NULL));