diff options
author | Christian Strømme <christian.stromme@digia.com> | 2012-10-16 11:34:00 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-18 00:58:11 +0200 |
commit | 6039179373f7552c2a711b06a7d69b9ca9d2b175 (patch) | |
tree | d8eddb1c9384c36e2ea2c4f4f27649e4c7bf18b1 /src/corelib/thread/qresultstore.h | |
parent | 8003fd6d5b12d51bfeb4fd5cd1f5c1b303c19df6 (diff) |
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 <morten.sorvig@digia.com>
Diffstat (limited to 'src/corelib/thread/qresultstore.h')
-rw-r--r-- | src/corelib/thread/qresultstore.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 3314cd7aaf..d084e24c0c 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -176,7 +176,10 @@ public: int addResults(int index, const QVector<T> *results, int totalCount) { - return ResultStoreBase::addResults(index, new QVector<T>(*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<T>(*results), results->count(), totalCount); } int addCanceledResult(int index) |