diff options
author | James O'Beirne <james.obeirne@pm.me> | 2021-06-16 16:27:20 -0400 |
---|---|---|
committer | James O'Beirne <james.obeirne@pm.me> | 2021-06-17 09:47:08 -0400 |
commit | 615c1adfb07b9b466173166dc2e53ace540e4b32 (patch) | |
tree | 4261a142c5886d8ec309292c0b91bd78e6861b8c /src/test/fuzz | |
parent | 6bc1eca01b2f88e081e71b783b3d45287700f8a5 (diff) | |
download | bitcoin-615c1adfb07b9b466173166dc2e53ace540e4b32.tar.xz |
refactor: wrap CCoinsViewCursor in unique_ptr
Specifically with CCoinsViewDB, if a raw cursor is allocated and
not freed, a cryptic leveldb assertion failure occurs on
CCoinsViewDB destruction.
See: https://github.com/google/leveldb/issues/142#issuecomment-414418135
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/coins_view.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/fuzz/coins_view.cpp b/src/test/fuzz/coins_view.cpp index 42f19d16c6..f452696689 100644 --- a/src/test/fuzz/coins_view.cpp +++ b/src/test/fuzz/coins_view.cpp @@ -183,8 +183,8 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view) } { - const CCoinsViewCursor* coins_view_cursor = backend_coins_view.Cursor(); - assert(coins_view_cursor == nullptr); + std::unique_ptr<CCoinsViewCursor> coins_view_cursor = backend_coins_view.Cursor(); + assert(!coins_view_cursor); (void)backend_coins_view.EstimateSize(); (void)backend_coins_view.GetBestBlock(); (void)backend_coins_view.GetHeadBlocks(); |