Fix delete/free mismatch in QtXmlPatterns
authorSami Rosendahl <ext-sami.1.rosendahl@nokia.com>
Tue, 24 Jan 2012 09:01:27 +0000 (11:01 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 27 Jan 2012 15:38:37 +0000 (16:38 +0100)
Fixes valgrind warning like this:
Mismatched free() / delete / delete []
  at: operator delete(void*) (vg_replace_malloc.c:387)
  by: QPatternist::Decimal::toString(double) (qdecimal.cpp:121)

Reason for the warning is that toString above calls qdtoa the result of
which should be released with free(), not delete.

Change-Id: Iff07f2d07a4d65c642167fd07b980c6bdd15c117
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
src/xmlpatterns/data/qdecimal.cpp

index caaf6c2..8d5654e 100644 (file)
@@ -118,7 +118,7 @@ QString Decimal::toString(const xsDecimal value)
         /* If the copy constructor is used instead of QString::operator=(),
          * it doesn't compile. I have no idea why. */
         const QString qret(QString::fromLatin1(result));
-        delete result;
+        free(result);
 
         QString valueAsString;