aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/fom.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-21 12:11:42 +0200
committerThomas White <taw@physics.org>2021-07-21 15:34:33 +0200
commit760f17f56b7f79f67a9029cbe7cc55a0acccd3b9 (patch)
tree608a86b923abe5564c7d1624f54fdf9b90b9a6ee /libcrystfel/src/fom.c
parent6d94d4115c254d344bbb927596a7141ef39fd298 (diff)
Make sure that memory gets freed on realloc failure
Diffstat (limited to 'libcrystfel/src/fom.c')
-rw-r--r--libcrystfel/src/fom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcrystfel/src/fom.c b/libcrystfel/src/fom.c
index 2f74e945..9ecb082d 100644
--- a/libcrystfel/src/fom.c
+++ b/libcrystfel/src/fom.c
@@ -731,8 +731,8 @@ static int wilson_scale(RefList *list1, RefList *list2, UnitCell *cell)
if ( n == max_n ) {
max_n *= 2;
- x = realloc(x, max_n*sizeof(double));
- y = realloc(y, max_n*sizeof(double));
+ x = srealloc(x, max_n*sizeof(double));
+ y = srealloc(y, max_n*sizeof(double));
if ( (x==NULL) || (y==NULL) ) {
ERROR("Failed to allocate memory for scaling.\n");
return 1;