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:
parent
741fc8b752
commit
f0c0ec59df
@ -9,6 +9,7 @@ int main(int argc, char **argv)
|
|||||||
if (QResource::registerResource("rcc_file.rcc") &&
|
if (QResource::registerResource("rcc_file.rcc") &&
|
||||||
QFile::exists("://resource_file.txt") && QFile::exists("://resource_file_two.txt"))
|
QFile::exists("://resource_file.txt") && QFile::exists("://resource_file_two.txt"))
|
||||||
{
|
{
|
||||||
|
QResource::unregisterResource("rcc_file.rcc"); // avoid leaks
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,5 +12,9 @@ int main(int, char **)
|
|||||||
|| !QFile::exists(":/resource2.txt")) {
|
|| !QFile::exists(":/resource2.txt")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid leaks
|
||||||
|
QResource::unregisterResource(RESOURCE1_FULL_PATH);
|
||||||
|
QResource::unregisterResource(RESOURCE2_FULL_PATH);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user