[glib: 2/3] gio/module: ignore module leak
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/3] gio/module: ignore module leak
- Date: Tue, 18 Oct 2022 11:06:41 +0000 (UTC)
commit d95cf75bf0aa415b5cb09778eb1cf800691ac186
Author: Marc-André Lureau <marcandre lureau redhat com>
Date: Tue Oct 18 11:01:11 2022 +0400
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>
gio/giomodule.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index d8ed9801e4..1c4b654c0d 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -579,7 +579,11 @@ g_io_modules_scan_all_in_directory_with_scope (const char *dirname,
{
/* Try to load and init types */
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
{
g_printerr ("Failed to load module: %s\n", path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]