aboutsummaryrefslogtreecommitdiff
path: root/src/partialator.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-01-27 16:30:06 +0100
committerThomas White <taw@physics.org>2021-01-27 16:30:06 +0100
commita1d18a25c32febb754c8ecf4c98320c111e52ad8 (patch)
treec3b0bde13ecae7dba0cd768186a1056a884226ef /src/partialator.c
parentc5c635c4cf3e62c3741f222aec440a8fff55fad0 (diff)
partialator: Fix (big) memory leaks
Diffstat (limited to 'src/partialator.c')
-rw-r--r--src/partialator.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 8422c05a..13b849e8 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -603,6 +603,7 @@ static int set_initial_params(Crystal *cr, FILE *fh, double force_bandwidth,
if ( force_lambda > 0.0 ) {
image->lambda = force_lambda;
}
+ spectrum_free(image->spectrum);
image->spectrum = spectrum_generate_gaussian(image->lambda, image->bw);
return 0;
@@ -1429,6 +1430,7 @@ int main(int argc, char *argv[])
Crystal *cr;
Crystal **crystals_new;
RefList *cr_refl;
+ RefList *cr_refl_raw;
struct image *image_for_crystal;
double lowest_r;
@@ -1482,9 +1484,10 @@ int main(int argc, char *argv[])
image_for_crystal->sat = NULL;
/* This is the raw list of reflections */
- cr_refl = crystal_get_reflections(cr);
+ cr_refl_raw = crystal_get_reflections(cr);
- cr_refl = apply_max_adu(cr_refl, max_adu);
+ cr_refl = apply_max_adu(cr_refl_raw, max_adu);
+ reflist_free(cr_refl_raw);
if ( !no_free ) select_free_reflections(cr_refl, rng);
@@ -1522,6 +1525,9 @@ int main(int argc, char *argv[])
}
+ free(stream_list.filenames);
+ free(stream_list.streams);
+
display_progress(n_images, n_crystals);
fprintf(stderr, "\n");
if ( sparams_fh != NULL ) fclose(sparams_fh);
@@ -1678,8 +1684,10 @@ int main(int argc, char *argv[])
gsl_rng_free(rng);
for ( i=0; i<n_crystals; i++ ) {
struct image *image = crystal_get_image(crystals[i]);
+ spectrum_free(image->spectrum);
reflist_free(crystal_get_reflections(crystals[i]));
free(image->filename);
+ free(image->ev);
free(image);
cell_free(crystal_get_cell(crystals[i]));
crystal_free(crystals[i]);