NanoComp / libctl

Guile-based library implementing flexible control files for scientific simulations
GNU General Public License v2.0
18 stars 23 forks source link

Correctly deallocate memory in `destroy_geom_box_tree` #58

Closed ahoenselaar closed 2 years ago

ahoenselaar commented 2 years ago

If nobjects is zero, then MALLOC is still called during the construction of the tree. However, malloc implementations can choose to return a non-NULL pointer in that case and the returned pointer should be freed in order to prevent leaks: https://en.cppreference.com/w/c/memory/malloc