From d5e19996fbed1a48112c6b6b569eb06fc7616c6b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 7 Sep 2021 16:26:56 +0200 Subject: init_fom: Clean up on error path --- libcrystfel/src/fom.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libcrystfel/src/fom.c') 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; icts[i] = 0; } -- cgit v1.2.3