aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/spectrum.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-21 11:51:56 +0200
committerThomas White <taw@physics.org>2021-07-21 15:34:31 +0200
commit6d94d4115c254d344bbb927596a7141ef39fd298 (patch)
tree652d07c4d6a9521c9359aa13bbda27309f53e6f8 /libcrystfel/src/spectrum.c
parent50cf52b0bc0baa683b9508568131a3f6281bf4ff (diff)
Add missing cleanup on error paths
Diffstat (limited to 'libcrystfel/src/spectrum.c')
-rw-r--r--libcrystfel/src/spectrum.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libcrystfel/src/spectrum.c b/libcrystfel/src/spectrum.c
index 78ad2e6e..bf38a73a 100644
--- a/libcrystfel/src/spectrum.c
+++ b/libcrystfel/src/spectrum.c
@@ -435,6 +435,7 @@ Spectrum *spectrum_load(const char *filename)
if ( fgets(line, 1024, fh) != line ) {
ERROR("Failed to read '%s'\n", filename);
spectrum_free(s);
+ fclose(fh);
return NULL;
}
@@ -444,6 +445,7 @@ Spectrum *spectrum_load(const char *filename)
ERROR("Failed to read ESRF spectrum from %s\n",
filename);
spectrum_free(s);
+ fclose(fh);
return NULL;
}
} else {