aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-10-30 13:32:48 +0100
committerThomas White <taw@physics.org>2018-10-30 13:32:48 +0100
commitd9480c67fd7a3f2c00ced29eed99689ec43780c9 (patch)
tree41d6e455a63c2db546512672397def6d8e00eadc
parent21ec571897192fef72050eda2527b5ef4e7f5fa7 (diff)
peakfinder8: Fix some use-after-free errors
-rw-r--r--libcrystfel/src/peakfinder8.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libcrystfel/src/peakfinder8.c b/libcrystfel/src/peakfinder8.c
index 39fe8a79..9090d48f 100644
--- a/libcrystfel/src/peakfinder8.c
+++ b/libcrystfel/src/peakfinder8.c
@@ -298,35 +298,35 @@ static struct radial_stats* allocate_radial_stats(int num_rad_bins)
rstats->rthreshold = (float *)malloc(num_rad_bins*sizeof(float));
if ( rstats->rthreshold == NULL ) {
- free(rstats);
free(rstats->roffset);
+ free(rstats);
return NULL;
}
rstats->lthreshold = (float *)malloc(num_rad_bins*sizeof(float));
if ( rstats->lthreshold == NULL ) {
- free(rstats);
free(rstats->rthreshold);
free(rstats->roffset);
+ free(rstats);
return NULL;
}
rstats->rsigma = (float *)malloc(num_rad_bins*sizeof(float));
if ( rstats->rsigma == NULL ) {
- free(rstats);
free(rstats->roffset);
free(rstats->rthreshold);
free(rstats->lthreshold);
+ free(rstats);
return NULL;
}
rstats->rcount = (int *)malloc(num_rad_bins*sizeof(int));
if ( rstats->rcount == NULL ) {
- free(rstats);
free(rstats->roffset);
free(rstats->rthreshold);
free(rstats->lthreshold);
free(rstats->rsigma);
+ free(rstats);
return NULL;
}
@@ -434,8 +434,8 @@ struct peakfinder_peak_data *allocate_peak_data(int max_num_peaks)
pkdata->npix = (int *)malloc(max_num_peaks*sizeof(int));
if ( pkdata->npix == NULL ) {
- free(pkdata);
free(pkdata->npix);
+ free(pkdata);
return NULL;
}