From b332d88b810f876034ee9879b0d3741a7c46a8b5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 1 Nov 2018 11:05:23 +0100 Subject: Fix possibly uninitialised dataf in read_cbf_data() --- libcrystfel/src/image.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index cbefae4f..26d48007 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -767,10 +767,15 @@ static float *read_cbf_data(struct imagefile *f, int *w, int *h, cbf_handle *pcb if ( elsize == 4 ) { dataf = convert_sint32_float(data, dimfast, dimmid); - } - if ( elsize == 2 ) { + } else if ( elsize == 2 ) { dataf = convert_sint16_float(data, dimfast, dimmid); + } else { + ERROR("Don't know how to convert element size %i\n", + (int)elsize); + cbf_free_handle(cbfh); + return NULL; } + free(data); free(buf); /* Might be NULL */ -- cgit v1.2.3