Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.6.3, 4.7.0
-
None
-
Linux with Valgrid tool
-
2636e58e748d066096472bc9822f89ba9d4b47a3
Description
I am trying to add a memory leak detection feature to QTestLib, so we can find out memory leak during test execution.
when i am using my updated qtestlib to run several test cases under tests/auto, i found memory leaks in some of them.
Below is a memory leak in QTestLib component:
------------------------------------
memory leak failure in tests/auto/qsqldatabase, test case precisionPolicy()
FAIL! : tst_QSqlDatabase::precisionPolicy(0_QSQLITE@/tmp/foo.db) memory leaked (36) bytes
------------------------------------
MemoryLeakAnalysis:
->tst_qsqldatabase.cpp, line 1732 (QEXPECT_FAIL("QOCI", "Oracle fails here, to retrieve next", Continue)
->qtestcase.cpp, line 1812 (return QTestResult::expectFail(dataIndex, qstrdup(comment), mode, file, line)
->qtestresult.cpp, line 195
if (!isExpectFailData(dataIndex))
return true; // we don't care
------------------------------------
MemoryLeak Place: src/testlib/qtestresult, line 195
MemoryLeak Scenario: Since the comment input argument is a newly created string on heap using qstrdup, it should be deleted before return at line 195.
Although I am testing on 4.6.3 branch, this error still exists on the trunk