From: Christian Strømme Date: Tue, 16 Oct 2012 09:34:00 +0000 (+0200) Subject: Fix for memory leak in ResultStore X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6039179373f7552c2a711b06a7d69b9ca9d2b175;p=profile%2Fivi%2Fqtbase.git Fix for memory leak in ResultStore In ResultStoreBase::addResults() it possible that the ResultItem we create is invalid (filter-mode enabled). Since an invalid ResultItem won't have any result data, we need to make sure that we don't allocate any data for it. Task-number: QTBUG-27224 Change-Id: Ic99b191db0e9dd4e29b64911f87d90a8148bb7a5 Reviewed-by: Morten Johan Sørvig --- diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 3314cd7..d084e24 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -176,7 +176,10 @@ public: int addResults(int index, const QVector *results, int totalCount) { - return ResultStoreBase::addResults(index, new QVector(*results), results->count(), totalCount); + if (m_filterMode == true && results->count() != totalCount && 0 == results->count()) + return ResultStoreBase::addResults(index, 0, 0, totalCount); + else + return ResultStoreBase::addResults(index, new QVector(*results), results->count(), totalCount); } int addCanceledResult(int index)