tst_QNetworkCookieJar: fix memleak
QTest::toString() returns a new[]'ed char array, which needs to be
manually deleted and QVERIFY2() doesn't take ownership of its second
argument.
Fix by wrapping in unique_ptr<char[]>(...).get().
Bug exists since the dawn of the public history.
Change-Id: I19ec09f46ec0ce5eacf1437f62dc625bc9343831
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d3c08df330
)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2d9d633cce
commit
8bf8c9113c
@ -14,6 +14,8 @@
|
||||
#include "private/qtldurl_p.h"
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
class tst_QNetworkCookieJar: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -249,7 +251,7 @@ void tst_QNetworkCookieJar::setCookiesFromUrl()
|
||||
QVERIFY2(result.contains(cookie), cookie.toRawForm());
|
||||
result.removeAll(cookie);
|
||||
}
|
||||
QVERIFY2(result.isEmpty(), QTest::toString(result));
|
||||
QVERIFY2(result.isEmpty(), std::unique_ptr<char[]>(QTest::toString(result)).get());
|
||||
}
|
||||
|
||||
void tst_QNetworkCookieJar::cookiesForUrl_data()
|
||||
|
Loading…
Reference in New Issue
Block a user