mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-02 10:27:07 -04:00
Fix memory leak in Entry::truncateHistory().
This commit is contained in:
parent
b88a0d8de3
commit
53fb28624e
1 changed files with 4 additions and 4 deletions
|
@ -361,7 +361,7 @@ void Entry::addHistoryItem(Entry* entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::truncateHistory() {
|
void Entry::truncateHistory() {
|
||||||
const Database *db = database();
|
const Database* db = database();
|
||||||
|
|
||||||
if (!db) {
|
if (!db) {
|
||||||
return;
|
return;
|
||||||
|
@ -385,8 +385,8 @@ void Entry::truncateHistory() {
|
||||||
int histMaxSize = db->metadata()->historyMaxSize();
|
int histMaxSize = db->metadata()->historyMaxSize();
|
||||||
if (histMaxSize > -1) {
|
if (histMaxSize > -1) {
|
||||||
int size = 0;
|
int size = 0;
|
||||||
QList<QByteArray>* foundAttachements = new QList<QByteArray>();
|
QList<QByteArray> foundAttachements;
|
||||||
attachments()->attachmentsSize(foundAttachements);
|
attachments()->attachmentsSize(&foundAttachements);
|
||||||
|
|
||||||
QMutableListIterator<Entry*> i(m_history);
|
QMutableListIterator<Entry*> i(m_history);
|
||||||
i.toBack();
|
i.toBack();
|
||||||
|
@ -395,7 +395,7 @@ void Entry::truncateHistory() {
|
||||||
|
|
||||||
// don't calculate size if it's already above the maximum
|
// don't calculate size if it's already above the maximum
|
||||||
if (size <= histMaxSize) {
|
if (size <= histMaxSize) {
|
||||||
size += entry->getSize(foundAttachements);
|
size += entry->getSize(&foundAttachements);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size > histMaxSize) {
|
if (size > histMaxSize) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue