diff options
author | Robert Griebl <robert.griebl@qt.io> | 2022-03-08 18:49:39 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2022-03-21 16:42:09 +0000 |
commit | 4178fd06ebf3af17019b29d7010a2b81571bec91 (patch) | |
tree | fa1e4b029af4bfa2c100e0d76d9e44c02094c9a4 /tests/auto/runtime | |
parent | 969864e00491d262cdaf167a8d72ea5b0538bc7d (diff) | |
download | qtapplicationmanager-4178fd06ebf3af17019b29d7010a2b81571bec91.tar.gz |
Fix memory leaks in the auto tests
Found by using the Linux/gcc/ASAN leak checker.
Change-Id: Id9e2aae8c79b0d1ae71f90e7fbbb876ff9076def
Pick-to: 6.3 6.3.0 6.2 6.2.4 5.15
Reviewed-by: Bernd Weimer <bernd.weimer@qt.io>
Diffstat (limited to 'tests/auto/runtime')
-rw-r--r-- | tests/auto/runtime/tst_runtime.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/runtime/tst_runtime.cpp b/tests/auto/runtime/tst_runtime.cpp index 4daf5b98..85f4e5fa 100644 --- a/tests/auto/runtime/tst_runtime.cpp +++ b/tests/auto/runtime/tst_runtime.cpp @@ -137,11 +137,13 @@ void tst_Runtime::factory() temp.close(); QScopedPointer<Application> a; + QScopedPointer<PackageInfo> pi; + QScopedPointer<Package> p; try { - PackageInfo *pi = PackageInfo::fromManifest(temp.fileName()); + pi.reset(PackageInfo::fromManifest(temp.fileName())); QVERIFY(pi); - Package *p = new Package(pi); - a.reset(new Application(pi->applications().constFirst(), p)); + p.reset(new Package(pi.get())); + a.reset(new Application(pi->applications().constFirst(), p.get())); } catch (const Exception &e) { QVERIFY2(false, qPrintable(e.errorString())); } |