mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-30 22:12:34 +02:00
Merge pull request #6488
17ac0f4
Avoid leaking file descriptors in RegisterLoad (Casey Rodarmor)
This commit is contained in:
commit
7cbed7fa28
@ -143,13 +143,14 @@ static void RegisterLoad(const string& strInput)
|
|||||||
valStr.insert(valStr.size(), buf, bread);
|
valStr.insert(valStr.size(), buf, bread);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ferror(f)) {
|
int error = ferror(f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
string strErr = "Error reading file " + filename;
|
string strErr = "Error reading file " + filename;
|
||||||
throw runtime_error(strErr);
|
throw runtime_error(strErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
// evaluate as JSON buffer register
|
// evaluate as JSON buffer register
|
||||||
RegisterSetJson(key, valStr);
|
RegisterSetJson(key, valStr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user