mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-28 09:14:18 -04:00
Fixed memory leaks in non-gui tests
Fixed 2 memory leaks in production code and a few in testcases. As a result leak_check_at_exit ASAN option does not need to turned off for non-gui tests. Smart pointers should be used elsewhere for consistency, but the sooner this fixes are delivered, the lesser memory leaks are introduced.
This commit is contained in:
parent
b20918b60e
commit
0ff75e7a88
10 changed files with 125 additions and 167 deletions
|
@ -148,13 +148,15 @@ void TestKeePass2Writer::testRepair()
|
|||
KeePass2Repair repair;
|
||||
QFile file(brokenDbFilename);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QCOMPARE(repair.repairDatabase(&file, key), KeePass2Repair::RepairSuccess);
|
||||
Database* dbRepaired = repair.database();
|
||||
auto result = repair.repairDatabase(&file, key);
|
||||
QCOMPARE(result.first, KeePass2Repair::RepairSuccess);
|
||||
Database* dbRepaired = result.second;
|
||||
QVERIFY(dbRepaired);
|
||||
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().size(), 1);
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->username(), QString("testuser").append(QChar(0x20AC)));
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->password(), QString("testpw"));
|
||||
delete dbRepaired;
|
||||
}
|
||||
|
||||
void TestKeePass2Writer::cleanupTestCase()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue