mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
uemis downloader: close reqtxt_file in case of error
Found by Coverity. Should switch to proper C++ type, though no priority for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a3340298b6
commit
f78662acce
1 changed files with 6 additions and 2 deletions
|
@ -285,14 +285,18 @@ static bool uemis_init(const std::string &path)
|
||||||
}
|
}
|
||||||
if (bytes_available(reqtxt_file) > 5) {
|
if (bytes_available(reqtxt_file) > 5) {
|
||||||
char tmp[6];
|
char tmp[6];
|
||||||
if (read(reqtxt_file, tmp, 5) != 5)
|
if (read(reqtxt_file, tmp, 5) != 5) {
|
||||||
|
close(reqtxt_file);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
tmp[5] = '\0';
|
tmp[5] = '\0';
|
||||||
#if UEMIS_DEBUG & 2
|
#if UEMIS_DEBUG & 2
|
||||||
report_info("::r req.txt \"%s\"\n", tmp);
|
report_info("::r req.txt \"%s\"\n", tmp);
|
||||||
#endif
|
#endif
|
||||||
if (sscanf(tmp + 1, "%d", &filenr) != 1)
|
if (sscanf(tmp + 1, "%d", &filenr) != 1) {
|
||||||
|
close(reqtxt_file);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
filenr = 0;
|
filenr = 0;
|
||||||
#if UEMIS_DEBUG & 2
|
#if UEMIS_DEBUG & 2
|
||||||
|
|
Loading…
Add table
Reference in a new issue