diff options
author | Thomas White <taw@physics.org> | 2024-01-16 12:03:15 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-02-06 16:59:34 +0100 |
commit | 4ad424f132dc3311502567e58b695fecdeb10106 (patch) | |
tree | 94fc0c1fe085de5f7e8553dced1f1b2a235fdf92 /libcrystfel/src/predict-refine.c | |
parent | 5960cc81e3e35e4d38fdd720680c98bef070d695 (diff) |
Use libcrystfel memory allocation routines everywhere
Diffstat (limited to 'libcrystfel/src/predict-refine.c')
-rw-r--r-- | libcrystfel/src/predict-refine.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c index 24045ddb..4cd0e54e 100644 --- a/libcrystfel/src/predict-refine.c +++ b/libcrystfel/src/predict-refine.c @@ -558,14 +558,14 @@ int refine_radius(Crystal *cr, struct image *image) RefList *reflist; /* Maximum possible size */ - rps = malloc(image_feature_count(image->features) - * sizeof(struct reflpeak)); + rps = cfmalloc(image_feature_count(image->features) + * sizeof(struct reflpeak)); if ( rps == NULL ) return 1; reflist = reflist_new(); n_acc = pair_peaks(image, cr, reflist, rps); if ( n_acc < 3 ) { - free(rps); + cffree(rps); reflist_free(reflist); return 1; } @@ -579,7 +579,7 @@ int refine_radius(Crystal *cr, struct image *image) crystal_set_profile_radius(cr, fabs(get_exerr(rps[n].refl))); reflist_free(reflist); - free(rps); + cffree(rps); return 0; } @@ -784,7 +784,7 @@ static double pred_residual(struct reflpeak *rps, int n, struct detgeom *det, /* NB Only for use when the list of reflpeaks was created without a RefList. - * If a RefList was used, then reflist_free the list then just free() the rps */ + * If a RefList was used, then reflist_free the list then just cffree() the rps */ static void free_rps_noreflist(struct reflpeak *rps, int n) { int i; @@ -792,7 +792,7 @@ static void free_rps_noreflist(struct reflpeak *rps, int n) for ( i=0; i<n; i++ ) { reflection_free(rps[i].refl); } - free(rps); + cffree(rps); } @@ -809,14 +809,14 @@ int refine_prediction(struct image *image, Crystal *cr, double total_shifts[12]; double res_r, res_fs, res_ss, res_overall; - rps = malloc(image_feature_count(image->features) - * sizeof(struct reflpeak)); + rps = cfmalloc(image_feature_count(image->features) + * sizeof(struct reflpeak)); if ( rps == NULL ) return 1; reflist = reflist_new(); n = pair_peaks(image, cr, reflist, rps); if ( n < 10 ) { - free(rps); + cffree(rps); reflist_free(reflist); return 1; } @@ -832,7 +832,7 @@ int refine_prediction(struct image *image, Crystal *cr, } if ( max_I <= 0.0 ) { ERROR("All peaks negative?\n"); - free(rps); + cffree(rps); crystal_set_reflections(cr, NULL); return 1; } @@ -888,7 +888,7 @@ int refine_prediction(struct image *image, Crystal *cr, for ( i=0; i<image->detgeom->n_panels; i++ ) { gsl_matrix_free(Minvs[i]); } - free(Minvs); + cffree(Minvs); crystal_set_reflections(cr, NULL); reflist_free(reflist); |