Permalink
Browse files

Merge pull request #6488

17ac0f4 Avoid leaking file descriptors in RegisterLoad (Casey Rodarmor)
  • Loading branch information...
laanwj committed Jul 29, 2015
2 parents eddaba7 + 17ac0f4 commit 7cbed7fa28d68b3071aaeec2a3f11bdd32de42f1
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/bitcoin-tx.cpp
View
@@ -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);
}

0 comments on commit 7cbed7f

Please sign in to comment.