From 90015d5037d76336dc7713de9bd5be0f786eda7d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 27 Feb 2020 13:50:25 +0100 Subject: image_read_hdf5(): Allocate bad maps --- libcrystfel/src/image.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index 41fc064b..8c4ba3fc 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -1427,13 +1427,18 @@ static struct image *image_read_hdf5(DataTemplate *dtempl, const char *filename, image->dp[pi] = malloc(dims[0]*dims[1]*sizeof(float)); image->sat[pi] = malloc(dims[0]*dims[1]*sizeof(float)); - if ( (image->dp[pi] == NULL) || (image->sat[pi] == NULL) ) { + image->bad[pi] = calloc(dims[0]*dims[1], sizeof(int)); + if ( (image->dp[pi] == NULL) + || (image->sat[pi] == NULL) + || (image->bad[pi] == NULL) ) + { ERROR("Failed to allocate panel %s\n", p->name); free(f_offset); free(f_count); for ( i=0; i<=pi; i++ ) { free(image->dp[i]); free(image->sat[i]); + free(image->bad[i]); } free(image->dp); free(image->bad); -- cgit v1.2.3