diff options
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/peaks.c | 32 | ||||
-rw-r--r-- | libcrystfel/src/reax.c | 7 |
2 files changed, 33 insertions, 6 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index ffe77290..047bac34 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -160,6 +160,8 @@ static int *make_BgMask(struct image *image, struct panel *p, mask = calloc(w*h, sizeof(int)); if ( mask == NULL ) return NULL; + if ( image->reflections == NULL ) return mask; + /* Loop over all reflections */ for ( refl = first_refl(image->reflections, &iter); refl != NULL; @@ -278,17 +280,26 @@ static int integrate_peak(struct image *image, int cfs, int css, /* It must have all the "good" bits to be valid */ if ( !((flags & image->det->mask_good) - == image->det->mask_good) ) return 1; + == image->det->mask_good) ) { + free(bgPkMask); + return 1; + } /* If it has any of the "bad" bits, reject */ - if ( flags & image->det->mask_bad ) return 1; + if ( flags & image->det->mask_bad ) { + free(bgPkMask); + return 1; + } } val = image->data[idx]; /* Veto peak if it contains saturation in bg region */ - if ( use_max_adu && (val > p->max_adu) ) return 1; + if ( use_max_adu && (val > p->max_adu) ) { + free(bgPkMask); + return 1; + } bg_tot += val; bg_tot_sq += pow(val, 2.0); @@ -330,17 +341,26 @@ static int integrate_peak(struct image *image, int cfs, int css, /* It must have all the "good" bits to be valid */ if ( !((flags & image->det->mask_good) - == image->det->mask_good) ) return 1; + == image->det->mask_good) ) { + free(bgPkMask); + return 1; + } /* If it has any of the "bad" bits, reject */ - if ( flags & image->det->mask_bad ) return 1; + if ( flags & image->det->mask_bad ) { + free(bgPkMask); + return 1; + } } val = image->data[idx] - bg_mean; /* Veto peak if it contains saturation */ - if ( use_max_adu && (image->data[idx] > p->max_adu) ) return 1; + if ( use_max_adu && (image->data[idx] > p->max_adu) ) { + free(bgPkMask); + return 1; + } pk_counts++; pk_total += val; diff --git a/libcrystfel/src/reax.c b/libcrystfel/src/reax.c index 58dce40a..3124a77c 100644 --- a/libcrystfel/src/reax.c +++ b/libcrystfel/src/reax.c @@ -348,6 +348,7 @@ static double iterate_refine_vector(double *x, double *y, double *z, gsl_matrix_free(C); gsl_vector_free(A); + gsl_vector_free(t); return dtmax; } @@ -1019,6 +1020,7 @@ void reax_index(IndexingPrivate *pp, struct image *image, UnitCell *cell) fftw_complex *fft_out; double pmax; struct reax_search *s; + int i; assert(pp->indm == INDEXING_REAX); p = (struct reax_private *)pp; @@ -1045,6 +1047,11 @@ void reax_index(IndexingPrivate *pp, struct image *image, UnitCell *cell) assemble_cells_from_candidates(image, s, cell); + for ( i=0; i<s->n_search; i++ ) { + free(s->search[i].cand); + } + free(s->search); + free(s); fftw_free(fft_in); fftw_free(fft_out); } |