summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-01-23 04:06:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-23 18:43:04 +0100
commit89bb20b937495fa63741241c8ea9780492fb6e45 (patch)
treebe80f23ef930789af7c5a0014c24b5d07213958e /src/testlib
parente20147d1d0cb02cae1424ae779b8392399fa8b24 (diff)
Revert "Fix mix of new[] / malloc in QTest::toHexRepresentation"
This reverts commit e8f73d656cf13d440a3a83980e05c6b117489e40. The original was correct: qtestcase.cpp:282 and 283 use delete[]. Change-Id: I668e17f500edcf9f1406553a160f6f5518dee148 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 2c8b7b20b7..e170d2a044 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1893,7 +1893,7 @@ char *toHexRepresentation(const char *ba, int length)
if (length > maxLen) {
const int size = len * 3 + 4;
- result = static_cast<char *>(malloc(size));
+ result = new char[size];
char *const forElipsis = result + size - 5;
forElipsis[0] = ' ';
@@ -1901,9 +1901,10 @@ char *toHexRepresentation(const char *ba, int length)
forElipsis[2] = '.';
forElipsis[3] = '.';
result[size - 1] = '\0';
- } else {
+ }
+ else {
const int size = len * 3;
- result = static_cast<char *>(malloc(size));
+ result = new char[size];
result[size - 1] = '\0';
}