From e8fa57ba93687fbd6841cb3a3d09c87037b5c713 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 10 Sep 2018 16:48:31 +0200 Subject: Make sure reflection contribution list gets freed --- libcrystfel/src/reflist-utils.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'libcrystfel/src/reflist-utils.c') diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c index 54c467b3..70548994 100644 --- a/libcrystfel/src/reflist-utils.c +++ b/libcrystfel/src/reflist-utils.c @@ -3,11 +3,11 @@ * * Utilities to complement the core reflist.c * - * Copyright © 2012-2017 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2018 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2011-2017 Thomas White + * 2011-2018 Thomas White * 2014 Valerio Mariani * * This file is part of CrystFEL. @@ -648,6 +648,30 @@ RefList *copy_reflist(RefList *list) } +/** + * free_contribs: + * @list: A %RefList + * + * Goes through @list and frees all the reflection contribution structures. + **/ +void free_contribs(RefList *list) +{ + Reflection *refl; + RefListIterator *iter; + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) + { + struct reflection_contributions *c; + c = get_contributions(refl); + free(c->contribs); + free(c->contrib_crystals); + free(c); + } +} + + static char *full_command_line(int argc, char *argv[]) { int i; -- cgit v1.2.3