[glib: 2/3] gio/module: fix leak when there is no cache




commit ad0fd6c5d9da1b1c00fdbc0cb3d1a9829e99faeb
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Mon Oct 17 14:32:09 2022 +0400

    gio/module: fix leak when there is no cache
    
    GIOModule is a helper object, we keep it around when there is a cache,
    but we should free it otherwise.
    
    Found thanks to ASAN.
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 gio/giomodule.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index fce60e9fc5..aa16231561 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -581,12 +581,8 @@ g_io_modules_scan_all_in_directory_with_scope (const char     *dirname,
              if (g_type_module_use (G_TYPE_MODULE (module)))
                g_type_module_unuse (G_TYPE_MODULE (module)); /* Unload */
              else
-               { /* Failure to load */
-                 g_printerr ("Failed to load module: %s\n", path);
-                 g_object_unref (module);
-                 g_free (path);
-                 continue;
-               }
+                g_printerr ("Failed to load module: %s\n", path);
+              g_object_unref (module);
            }
 
          g_free (path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]