From 59e3073b1cb944128b7533dd85be13074ab07b72 Mon Sep 17 00:00:00 2001 From: Peng Wenhao Date: Fri, 24 Jul 2020 13:55:07 +0800 Subject: Close memory leak in QTestLib support for string to numeric testing QTest::toString allocates memory by calling qstrdup; that memory must be freed by the caller. Change-Id: I9724db0c617884cf08592968b1411f002ef23204 Reviewed-by: Volker Hilsheimer Reviewed-by: Edward Welbourne --- tests/benchmarks/testlib/tostring/tst_tostring.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/benchmarks/testlib/tostring/tst_tostring.cpp b/tests/benchmarks/testlib/tostring/tst_tostring.cpp index 1731929f98..a1c4aba916 100644 --- a/tests/benchmarks/testlib/tostring/tst_tostring.cpp +++ b/tests/benchmarks/testlib/tostring/tst_tostring.cpp @@ -95,7 +95,8 @@ void tst_toString::numeric() QFETCH(T, datum); QBENCHMARK { - QTest::toString(datum); + auto tst = QTest::toString(datum); + delete [] tst; } } -- cgit v1.2.3