aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorKenneth Beyerlein <kenneth.beyerlein@desy.de>2014-01-16 15:43:01 +0100
committerThomas White <taw@physics.org>2014-01-21 11:08:48 +0100
commitaff5385ebdeea53a7029e676378ff17a7ecf5eb4 (patch)
treef4a8b028fc6bdf629934c33fd3f5d89584ded4e0 /libcrystfel
parent06461a6c1e0a72af2fb8a63f76f15547d5367924 (diff)
Fixed memory leaks in free_all_crystals function
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/image.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 8fe3d69c..dcfd9b2a 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -182,8 +182,13 @@ void image_add_crystal(struct image *image, Crystal *cryst)
void free_all_crystals(struct image *image)
{
int i;
-
+ if ( image->crystals == NULL ) return;
for ( i=0; i<image->n_crystals; i++ ) {
+ Crystal *cr= image->crystals[i];
+ reflist_free(crystal_get_reflections(cr));
+ cell_free(crystal_get_cell(cr));
crystal_free(image->crystals[i]);
}
+ free(image->crystals);
+ image->n_crystals = 0;
}