mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +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) {
|
||||
char tmp[6];
|
||||
if (read(reqtxt_file, tmp, 5) != 5)
|
||||
if (read(reqtxt_file, tmp, 5) != 5) {
|
||||
close(reqtxt_file);
|
||||
return false;
|
||||
}
|
||||
tmp[5] = '\0';
|
||||
#if UEMIS_DEBUG & 2
|
||||
report_info("::r req.txt \"%s\"\n", tmp);
|
||||
#endif
|
||||
if (sscanf(tmp + 1, "%d", &filenr) != 1)
|
||||
if (sscanf(tmp + 1, "%d", &filenr) != 1) {
|
||||
close(reqtxt_file);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
filenr = 0;
|
||||
#if UEMIS_DEBUG & 2
|
||||
|
|
Loading…
Reference in a new issue