mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-28 11:38:33 +01:00
patch memory leaks using analyzer
This commit is contained in:
+21
-7
@@ -2,6 +2,7 @@
|
||||
#include <iostream>
|
||||
#include "wallet2.h"
|
||||
#include "wallet/monero_wallet_full.h"
|
||||
#include "utils/monero_utils.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -29,13 +30,26 @@ int main(int argc, const char* argv[]) {
|
||||
int network_type = 2;
|
||||
|
||||
// load wallet
|
||||
monero_wallet* wallet = monero_wallet_full::open_wallet("../../test_wallets/test_wallet_1", "supersecretpassword123", monero_network_type::STAGENET);
|
||||
wallet->set_daemon_connection("http://localhost:38081", "", "");
|
||||
monero_wallet* wallet = monero_wallet_full::open_wallet("../../test_wallets/test_wallet_1", "supersecretpassword123", monero_network_type::TESTNET);
|
||||
wallet->set_daemon_connection("http://localhost:28081", "", "");
|
||||
|
||||
// fetch txs
|
||||
// get txs
|
||||
vector<shared_ptr<monero_tx_wallet>> txs = wallet->get_txs();
|
||||
MINFO("Wallet has " << txs.size() << " txs. Printing some.");
|
||||
for (int i = 0; i < txs.size() && i < 10; i++) {
|
||||
MINFO(txs[i]->serialize());
|
||||
}
|
||||
MINFO("Wallet has " << txs.size() << " txs");
|
||||
for (int i = 0; i < txs.size() && i < 10; i++) MINFO(txs[i]->serialize());
|
||||
monero_utils::free(txs);
|
||||
|
||||
// get transfers
|
||||
vector<shared_ptr<monero_transfer>> transfers = wallet->get_transfers(monero_transfer_query());
|
||||
MINFO("Wallet has " << transfers.size() << " transfers");
|
||||
monero_utils::free(transfers);
|
||||
|
||||
// get outputs
|
||||
vector<shared_ptr<monero_output_wallet>> outputs = wallet->get_outputs(monero_output_query());
|
||||
MINFO("Wallet has " << outputs.size() << " outputs");
|
||||
monero_utils::free(outputs);
|
||||
|
||||
// close wallet and free pointer
|
||||
wallet->close(true);
|
||||
delete wallet;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user