city_generator2

Generated conformal 3D meshes representing a city
git clone git://git.meso-star.fr/city_generator2.git
Log | Files | Refs | README | LICENSE

commit 054dfa535a1ce4c41d1613b540c7ad1aaeeefe5e
parent c2a2f7858b5249a3810394e44ed331d2227adc53
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Tue, 14 Jan 2025 15:51:46 +0100

Fix a memleak

A memleak could occur in some error situations.
The ground structure was not released properly.

Diffstat:
Msrc/cg_city.c | 1+
Msrc/cg_ground.c | 8++++----
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/cg_city.c b/src/cg_city.c @@ -632,6 +632,7 @@ release_city(struct city* city) htable_common_release(&city->common); htable_names_release(&city->dump_footprint_names); } + ground_clear(&city->ground); /* iterate on building */ for (i = 0; i < city->allocated_buildings_count; i++) { struct building* building = city->buildings + i; diff --git a/src/cg_ground.c b/src/cg_ground.c @@ -209,10 +209,10 @@ ground_clear (struct ground* ground) { GDEL(ground->box); - darray_geometries_release(&ground->footprints); - darray_geometries_release(&ground->boundaries); - darray_double_release(&ground->ground_building_connections); - darray_double_release(&ground->ground_patches); + darray_geometries_purge(&ground->footprints); + darray_geometries_purge(&ground->boundaries); + darray_double_purge(&ground->ground_building_connections); + darray_double_purge(&ground->ground_patches); } #undef GDEL