What changed, and why it matters
This change adds a virtual destructor to a C++ interface class (WalletManager) and its implementation (WalletManagerImpl). In C++, an interface used as a base class without a virtual destructor can cause undefined behavior when an object is deleted through a base-class pointer, typically leading only to memory corruption or crashes rather than direct code execution. The patch is a defensive correctness fix.
Treat as a low-risk code-quality/hardening fix. No urgent action is required beyond normal review and testing. If the wallet API is exposed to untrusted callers, ensure the fix is included in the next release as part of routine hardening.
Security signals we found
C++ abstract base class now has a virtual destructor
Defensive fix for polymorphic deletion correctness
No explicit security claim or exploit described in commit
Evidence from the diff
The commit adds virtual ~WalletManager() = 0; to the abstract Monero::WalletManager interface in wallet2_api.h and provides out-of-line definitions for both WalletManager::~WalletManager() and WalletManagerImpl::~WalletManagerImpl(). This ensures that destruction of derived WalletManagerImpl objects through a base WalletManager* calls the correct destructors, preventing potential resource leaks or undefined behavior. The change is small and defensive; no exploit path or security incident is described in the commit materials.
Changed components
src/wallet/api/wallet2_api.hsrc/wallet/api/wallet_manager.cppsrc/wallet/api/wallet_manager.hInspect captured patch +9 / −0
### src/wallet/api/wallet2_api.h
@@ -1162,6 +1162,7 @@ struct Wallet
*/
struct WalletManager
{
+ virtual ~WalletManager() = 0;
/*!
* \brief Creates new wallet
### src/wallet/api/wallet_manager.cpp
@@ -45,6 +45,12 @@
namespace Monero {
+WalletManager::~WalletManager()
+{}
+
+WalletManagerImpl::~WalletManagerImpl()
+{}
+
WalletManagerImpl::WalletManagerImpl()
{
tools::set_strict_default_file_permissions(true);
### src/wallet/api/wallet_manager.h
@@ -38,6 +38,8 @@ namespace Monero {
class WalletManagerImpl : public WalletManager
{
public:
+ virtual ~WalletManagerImpl() override;
+
Wallet * createWallet(const std::string &path, const std::string &password,
const std::string &language, NetworkType nettype, uint64_t kdf_rounds = 1) override;
Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) override;Why this scored 23/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.