From 53fb28624e044090df290cd13408eb09715956d7 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Mon, 14 May 2012 16:29:22 +0200 Subject: [PATCH] Fix memory leak in Entry::truncateHistory(). --- src/core/Entry.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index 4dbdb3cc6..9e70920fa 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -361,7 +361,7 @@ void Entry::addHistoryItem(Entry* entry) } void Entry::truncateHistory() { - const Database *db = database(); + const Database* db = database(); if (!db) { return; @@ -385,8 +385,8 @@ void Entry::truncateHistory() { int histMaxSize = db->metadata()->historyMaxSize(); if (histMaxSize > -1) { int size = 0; - QList* foundAttachements = new QList(); - attachments()->attachmentsSize(foundAttachements); + QList foundAttachements; + attachments()->attachmentsSize(&foundAttachements); QMutableListIterator i(m_history); i.toBack(); @@ -395,7 +395,7 @@ void Entry::truncateHistory() { // don't calculate size if it's already above the maximum if (size <= histMaxSize) { - size += entry->getSize(foundAttachements); + size += entry->getSize(&foundAttachements); } if (size > histMaxSize) {