Fix memory leaks

This renders these simple tests ASAN and LSAN (Address Sanitizer
and Leak Sanitizer) clean.

Change-Id: Ibe5b7054a20c1575a1a7939b0bed4101afeeee56
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Dimitrios Apostolou 2022-06-03 16:38:16 +02:00
parent 741fc8b752
commit f0c0ec59df
2 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,7 @@ int main(int argc, char **argv)
if (QResource::registerResource("rcc_file.rcc") &&
QFile::exists("://resource_file.txt") && QFile::exists("://resource_file_two.txt"))
{
QResource::unregisterResource("rcc_file.rcc"); // avoid leaks
return 0;
}

View File

@ -12,5 +12,9 @@ int main(int, char **)
|| !QFile::exists(":/resource2.txt")) {
return -1;
}
// Avoid leaks
QResource::unregisterResource(RESOURCE1_FULL_PATH);
QResource::unregisterResource(RESOURCE2_FULL_PATH);
return 0;
}