diff options
author | Thomas White <taw@physics.org> | 2018-09-10 16:48:31 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-09-10 16:48:31 +0200 |
commit | e8fa57ba93687fbd6841cb3a3d09c87037b5c713 (patch) | |
tree | 525fff0e4393a41021550ebdad33e53197b0a4cf /src | |
parent | 8063500c1458e71cc5530620681e5adfdda62fa5 (diff) |
Make sure reflection contribution list gets freed
Diffstat (limited to 'src')
-rw-r--r-- | src/merge.c | 15 | ||||
-rw-r--r-- | src/partialator.c | 6 | ||||
-rw-r--r-- | src/scaling.c | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/merge.c b/src/merge.c index 3b850c30..9d36a359 100644 --- a/src/merge.c +++ b/src/merge.c @@ -3,11 +3,11 @@ * * Parallel weighted merging of intensities * - * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2018 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2010-2015 Thomas White <taw@physics.org> + * 2010-2018 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -46,6 +46,7 @@ #include "cell.h" #include "utils.h" #include "reflist.h" +#include "reflist-utils.h" #include "cell-utils.h" @@ -319,6 +320,16 @@ RefList *merge_intensities(Crystal **crystals, int n, int n_threads, get_indices(refl, &h, &k, &l); r2 = add_refl(full2, h, k, l); copy_data(r2, refl); + + } else { + + /* We do not need the contribution list any more */ + struct reflection_contributions *c; + c = get_contributions(refl); + free(c->contribs); + free(c->contrib_crystals); + free(c); + } } diff --git a/src/partialator.c b/src/partialator.c index fa07eab7..78b7173b 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -199,12 +199,14 @@ static void write_split(Crystal **crystals, int n_crystals, const char *outfile, STATUS("Writing two-way split to %s ", tmp); write_reflist_2(tmp, split, sym); + free_contribs(split); reflist_free(split); snprintf(tmp, 1024, "%s2", outfile); split = merge_intensities(crystals2, n_crystals2, nthreads, min_measurements, push_res, 1); STATUS("and %s\n", tmp); write_reflist_2(tmp, split, sym); + free_contribs(split); reflist_free(split); } @@ -291,6 +293,7 @@ static void write_custom_split(struct custom_split *csplit, int dsn, split = merge_intensities(crystalsn, n_crystalsn, nthreads, min_measurements, push_res, 1); write_reflist_2(tmp, split, sym); + free_contribs(split); reflist_free(split); write_split(crystalsn, n_crystalsn, tmp, nthreads, pmodel, @@ -1436,6 +1439,7 @@ int main(int argc, char *argv[]) /* Create new reference if needed */ if ( reference == NULL ) { + free_contribs(full); reflist_free(full); if ( !no_scale ) { scale_all(crystals, n_crystals, nthreads, @@ -1484,6 +1488,7 @@ int main(int argc, char *argv[]) /* Final merge */ STATUS("Final merge...\n"); if ( reference == NULL ) { + free_contribs(full); reflist_free(full); if ( !no_scale ) { scale_all(crystals, n_crystals, nthreads, scaleflags); @@ -1530,6 +1535,7 @@ int main(int argc, char *argv[]) reflist_free(crystal_get_reflections(crystals[i])); crystal_free(crystals[i]); } + free_contribs(full); reflist_free(full); free_symoplist(sym); free(outfile); diff --git a/src/scaling.c b/src/scaling.c index 21bd0db2..68456900 100644 --- a/src/scaling.c +++ b/src/scaling.c @@ -46,6 +46,7 @@ #include "cell.h" #include "cell-utils.h" #include "scaling.h" +#include "reflist-utils.h" struct scale_args @@ -166,6 +167,7 @@ void scale_all(Crystal **crystals, int n_crystals, int nthreads, int scaleflags) meanB /= n_crystals; STATUS("Mean B = %e\n", meanB); + free_contribs(full); reflist_free(full); niter++; |