-
Notifications
You must be signed in to change notification settings - Fork 37.7k
wallet: Fix potential memory leak when loading a corrupted wallet file #11007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3d02045
to
5e4e5c8
Compare
@@ -3886,15 +3886,12 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile) | |||
uiInterface.InitMessage(_("Zapping all transactions from wallet...")); | |||
|
|||
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, walletFile)); | |||
CWallet *tempWallet = new CWallet(std::move(dbw)); | |||
std::unique_ptr<CWallet> tempWallet(new CWallet(std::move(dbw))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: If you move the previous line into this one, you can omit the std::move
operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @eklitzke is right here that it would be good to avoid that std::move.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too long?
Please avoid titling PR's with things like "Fix memory leak" for things where there isn't an actual leak in practice. (e.g. because it exits). Changes like this are good but they mess up people trying to figure out if an issue they are encounter has been fixed ("I have a memory leak, oh they just fixed one. They's probably it."), or when slowing things down when looking for other issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
@gmaxwell That's a good point! I've now changed to "Fix potential memory leak" - works or still room for improvement? :-) |
5e4e5c8
to
c8b4b80
Compare
utACK c8b4b80df8346739c9a52113fd6673db1574e1f3 |
c8b4b80
to
c06755f
Compare
Rebased! |
…ted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
… corrupted wallet file c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
Fix potential memory leak when loading a corrupted wallet file.