aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-07-26 12:33:19 +0200
committerThomas White <taw@physics.org>2023-07-28 13:22:05 +0200
commit90fe1f06757cc65b60747a07dda5e18ff1329c3a (patch)
tree14aae6821dd3dc431445639857b72359e9771760 /libcrystfel/src
parentdf5045d0bddc63167efcda94d11444c0c1c2c093 (diff)
detgeom_free: Free the groups as well
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/detgeom.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libcrystfel/src/detgeom.c b/libcrystfel/src/detgeom.c
index e59eb4bd..3516d996 100644
--- a/libcrystfel/src/detgeom.c
+++ b/libcrystfel/src/detgeom.c
@@ -64,6 +64,20 @@ void detgeom_transform_coords(struct detgeom_panel *p,
}
+static void free_group(struct detgeom_panel_group *g)
+{
+ int i;
+
+ for ( i=0; i<g->n_children; i++ ) {
+ free_group(g->children[i]);
+ }
+
+ free(g->name);
+ free(g->children);
+ free(g);
+}
+
+
void detgeom_free(struct detgeom *detgeom)
{
int i;
@@ -74,6 +88,7 @@ void detgeom_free(struct detgeom *detgeom)
free(detgeom->panels[i].name);
}
+ free_group(detgeom->top_group);
free(detgeom->panels);
free(detgeom);
}