gio/module: ignore module leak

A module must exist forever after it is loaded. If it's not referenced
anywhere, as with some gio tests, ASAN will report direct leaks. Silence
those.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-10-18 11:01:11 +04:00
parent 3967d1da56
commit d95cf75bf0

View File

@ -579,7 +579,11 @@ g_io_modules_scan_all_in_directory_with_scope (const char *dirname,
{ {
/* Try to load and init types */ /* Try to load and init types */
if (g_type_module_use (G_TYPE_MODULE (module))) if (g_type_module_use (G_TYPE_MODULE (module)))
g_type_module_unuse (G_TYPE_MODULE (module)); /* Unload */ {
g_type_module_unuse (G_TYPE_MODULE (module)); /* Unload */
/* module must remain alive, because the type system keeps weak refs */
g_ignore_leak (module);
}
else else
{ {
g_printerr ("Failed to load module: %s\n", path); g_printerr ("Failed to load module: %s\n", path);