Raphaelcoeffic/fix 6716 (#6753)

fixed file descriptor leaks in radio tools
This commit is contained in:
Bertrand Songis
2019-09-12 10:02:15 +02:00
committed by GitHub
parent 3db78814e8
commit 0aaf2a39f1
6 changed files with 320 additions and 4 deletions
+4 -3
View File
@@ -1131,10 +1131,11 @@ bool readToolName(char * toolName, const char * filename)
return "Error opening file";
}
if (f_read(&file, &buffer, sizeof(buffer), &count) != FR_OK) {
f_close(&file);
FRESULT res = f_read(&file, &buffer, sizeof(buffer), &count);
f_close(&file);
if (res != FR_OK)
return false;
}
const char * tns = "TNS|";
auto * start = std::search(buffer, buffer + sizeof(buffer), tns, tns + 4);