mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Fixed ledger read fd leak. Reordered subsystem init. (#138)
This commit is contained in:
@@ -333,6 +333,7 @@ namespace ledger
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) == -1)
|
||||
{
|
||||
close(fd);
|
||||
LOG_ERROR << errno << ": Error in ledger file stat. " << file_path;
|
||||
return -1;
|
||||
}
|
||||
@@ -340,10 +341,12 @@ namespace ledger
|
||||
buffer.resize(st.st_size);
|
||||
if (read(fd, buffer.data(), buffer.size()) == -1)
|
||||
{
|
||||
close(fd);
|
||||
LOG_ERROR << errno << ": Error reading ledger file. " << file_path;
|
||||
return -1;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user