From 2f4033255192812bd3c01bd8568a083dcd72ec65 Mon Sep 17 00:00:00 2001 From: Keitaro Yamashita Date: Sat, 29 Nov 2014 03:10:08 +0900 Subject: process_hkl: Fix memory leak when --start-after= used. --- src/process_hkl.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/process_hkl.c b/src/process_hkl.c index 9abfc501..8e82b1a1 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -426,20 +426,16 @@ static int merge_all(Stream *st, RefList *model, RefList *reference, Crystal *cr = image.crystals[i]; n_crystals_seen++; - if ( n_crystals_seen <= start_after ) continue; - - if ( crystal_get_resolution_limit(cr) < min_res ) { - continue; + if ( (n_crystals_seen > start_after) + && (crystal_get_resolution_limit(cr) >= min_res) ) { + n_crystals++; + r = merge_crystal(model, &image, cr, reference, sym, + hist_vals, hist_h, hist_k, hist_l, + hist_i, config_nopolar, min_snr, + max_adu, push_res, min_cc, do_scale, stat); + if ( r == 0 ) n_crystals_used++; } - n_crystals++; - r = merge_crystal(model, &image, cr, reference, sym, - hist_vals, hist_h, hist_k, hist_l, - hist_i, config_nopolar, min_snr, - max_adu, push_res, min_cc, do_scale, stat); - - if ( r == 0 ) n_crystals_used++; - reflist_free(crystal_get_reflections(cr)); cell_free(crystal_get_cell(cr)); crystal_free(cr); -- cgit v1.2.3