aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-09-07 16:26:56 +0200
committerThomas White <taw@physics.org>2021-09-07 16:26:56 +0200
commitd5e19996fbed1a48112c6b6b569eb06fc7616c6b (patch)
tree7c6d571374e44ed66eba99257bd2a92235c19405 /libcrystfel
parent5692430eac2d781f10cd8756045326bb84e4aadb (diff)
init_fom: Clean up on error path
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/fom.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libcrystfel/src/fom.c b/libcrystfel/src/fom.c
index 9ecb082d..d27023ae 100644
--- a/libcrystfel/src/fom.c
+++ b/libcrystfel/src/fom.c
@@ -84,6 +84,10 @@ static struct fom_context *init_fom(enum fom_type fom, int nmax, int nshells)
fctx->fom = fom;
fctx->nshells = nshells;
fctx->cts = malloc(nshells*sizeof(int));
+ if ( fctx->cts == NULL ) {
+ free(fctx);
+ return NULL;
+ }
for ( i=0; i<nshells; i++ ) {
fctx->cts[i] = 0;
}