mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
fixed file descriptor leaks in radio tools (#6748)
This commit is contained in:
parent
8a1f7a2b97
commit
bb1c2b072b
2 changed files with 6 additions and 4 deletions
|
@ -116,6 +116,7 @@ void menuRadioTools(event_t event)
|
||||||
if (isRadioScriptTool(fno.fname))
|
if (isRadioScriptTool(fno.fname))
|
||||||
addRadioScriptTool(index++, path);
|
addRadioScriptTool(index++, path);
|
||||||
}
|
}
|
||||||
|
f_closedir(&dir);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -124,4 +125,4 @@ void menuRadioTools(event_t event)
|
||||||
}
|
}
|
||||||
|
|
||||||
reusableBuffer.radioTools.linesCount = index;
|
reusableBuffer.radioTools.linesCount = index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1131,10 +1131,11 @@ bool readToolName(char * toolName, const char * filename)
|
||||||
return "Error opening file";
|
return "Error opening file";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_read(&file, &buffer, sizeof(buffer), &count) != FR_OK) {
|
FRESULT res = f_read(&file, &buffer, sizeof(buffer), &count);
|
||||||
f_close(&file);
|
f_close(&file);
|
||||||
|
|
||||||
|
if (res != FR_OK)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
const char * tns = "TNS|";
|
const char * tns = "TNS|";
|
||||||
auto * start = std::search(buffer, buffer + sizeof(buffer), tns, tns + 4);
|
auto * start = std::search(buffer, buffer + sizeof(buffer), tns, tns + 4);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue