From 8823325c55d3e39f066e0a4a54234f84037aab1c Mon Sep 17 00:00:00 2001 From: Michael Black Date: Fri, 6 Dec 2019 12:01:28 -0600 Subject: [PATCH] Fix FILE* leak in test7400ADC.c --- ts7400/include/test7400ADC.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ts7400/include/test7400ADC.c b/ts7400/include/test7400ADC.c index db13aa8ca..76ee67584 100644 --- a/ts7400/include/test7400ADC.c +++ b/ts7400/include/test7400ADC.c @@ -45,6 +45,7 @@ int read_calibration(int buf[NUM_CHANNELS][2]) if (fread(cal, NUM_CHANNELS * 4, 1, f) == 1) { + fclose(f); for (j = 0; j < 2; j++) for (i = 0; i < NUM_CHANNELS; i++) { @@ -67,6 +68,8 @@ empty_calibration: printf("/etc/ADC-calibration.dat not found or it's not readable\n"); + fclose(f); + return 0; }