HomePhabricator

[wallet] Fix leak in CDB constructor

Authored by João Barbosa <joao.paulo.barbosa@gmail.com> on Oct 12 2017, 22:14.

Description

[wallet] Fix leak in CDB constructor

Summary:
Now using a std::unique_ptr, the Db instance is correctly released
when CDB initialization fails.
The internal CDB state and mapFileUseCount are only mutated when
the CDB initialization succeeds.

Backport of core PR11492
Complete T220

Test Plan:

make check

Reviewers: #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2231

Details

Committed
FabienDec 28 2018, 23:00
Pushed
FabienDec 28 2018, 23:00
Reviewer
Restricted Project
Differential Revision
D2231: [wallet] Fix leak in CDB constructor
Parents
rABC35917919af7d: wallet: Fix memory leak when loading a corrupted wallet file
Branches
Unknown
Tags
Unknown

Event Timeline

Fabien committed rABCb58465e258eb: [wallet] Fix leak in CDB constructor (authored by João Barbosa <joao.paulo.barbosa@gmail.com>).Dec 28 2018, 23:00