summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qlogging.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 50d35a6d84..86ba082398 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -866,7 +866,7 @@ QMessagePattern::QMessagePattern()
QMessagePattern::~QMessagePattern()
{
- for (int i = 0; literals[i] != 0; ++i)
+ for (int i = 0; literals[i]; ++i)
delete [] literals[i];
delete [] literals;
literals = 0;
@@ -876,8 +876,12 @@ QMessagePattern::~QMessagePattern()
void QMessagePattern::setPattern(const QString &pattern)
{
+ if (literals) {
+ for (int i = 0; literals[i]; ++i)
+ delete [] literals[i];
+ delete [] literals;
+ }
delete [] tokens;
- delete [] literals;
// scanner
QList<QString> lexemes;