From 89bb20b937495fa63741241c8ea9780492fb6e45 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 23 Jan 2014 04:06:10 +0100 Subject: 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 --- src/testlib/qtestcase.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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(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(malloc(size)); + result = new char[size]; result[size - 1] = '\0'; } -- cgit v1.2.3