From aff5385ebdeea53a7029e676378ff17a7ecf5eb4 Mon Sep 17 00:00:00 2001 From: Kenneth Beyerlein Date: Thu, 16 Jan 2014 15:43:01 +0100 Subject: Fixed memory leaks in free_all_crystals function --- libcrystfel/src/image.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src/image.c') 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; in_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; } -- cgit v1.2.3