diff options
author | Thomas White <taw@bitwiz.org.uk> | 2012-07-11 23:42:31 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2012-07-11 23:42:31 +0200 |
commit | 56e9def44180382400bf0e59dbd0b8cdf55ca3f4 (patch) | |
tree | 23e3ff53f4c95a30915f86a0ee0dd0ef0c06795d /libcrystfel/src/peaks.c | |
parent | 849df8b6dd7de1d45eaf8af1f4f2b1c1d72e5c9c (diff) |
More memory leaks
Diffstat (limited to 'libcrystfel/src/peaks.c')
-rw-r--r-- | libcrystfel/src/peaks.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index 047bac34..0a6a439c 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -308,7 +308,10 @@ static int integrate_peak(struct image *image, int cfs, int css, } } - if ( bg_counts == 0 ) return 1; + if ( bg_counts == 0 ) { + free(bgPkMask); + return 1; + } bg_mean = bg_tot / bg_counts; bg_var = (bg_tot_sq/bg_counts) - pow(bg_mean, 2.0); @@ -378,7 +381,10 @@ static int integrate_peak(struct image *image, int cfs, int css, var = pk_counts * bg_var; var += aduph * pk_total; - if ( var < 0.0 ) return 1; + if ( var < 0.0 ) { + free(bgPkMask); + return 1; + } if ( intensity != NULL ) *intensity = pk_total; if ( sigma != NULL ) *sigma = sqrt(var); |