diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-07-29 18:58:54 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-07-29 18:59:23 +0200 |
commit | 7cbed7fa28d68b3071aaeec2a3f11bdd32de42f1 (patch) | |
tree | 7cbdbcb881eae987d2c5de260831c4284a53ea73 /src | |
parent | eddaba7b5692288087a926da5733e86b47274e4e (diff) | |
parent | 17ac0f402559f57733fb5da6dafb72cf0f50795f (diff) | |
download | bitcoin-7cbed7fa28d68b3071aaeec2a3f11bdd32de42f1.tar.xz |
Merge pull request #6488
17ac0f4 Avoid leaking file descriptors in RegisterLoad (Casey Rodarmor)
Diffstat (limited to 'src')
-rw-r--r-- | src/bitcoin-tx.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 9ad57d5c6f..e389d51a73 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -143,13 +143,14 @@ static void RegisterLoad(const string& strInput) valStr.insert(valStr.size(), buf, bread); } - if (ferror(f)) { + int error = ferror(f); + fclose(f); + + if (error) { string strErr = "Error reading file " + filename; throw runtime_error(strErr); } - fclose(f); - // evaluate as JSON buffer register RegisterSetJson(key, valStr); } |