[gdm: 3/4] gdm-local-display-factory: Plug a memory leak




commit 75ac44ec86af05bf01be3420cc733c3dfcb5cd18
Author: Alessandro Bono <alessandro bono369 gmail com>
Date:   Wed Sep 14 17:13:18 2022 +0200

    gdm-local-display-factory: Plug a memory leak
    
    The error was never freed. While at it, convert also the id to use
    g_autofree.

 daemon/gdm-local-display-factory.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 8c912cc6d..dae2b2411 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -1502,9 +1502,9 @@ handle_create_transient_display (GdmDBusLocalDisplayFactory *skeleton,
                                  GDBusMethodInvocation      *invocation,
                                  GdmLocalDisplayFactory     *factory)
 {
-        GError *error = NULL;
+        g_autoptr(GError) error = NULL;
+        g_autofree char *id = NULL;
         gboolean created;
-        char *id = NULL;
 
         created = gdm_local_display_factory_create_transient_display (factory,
                                                                       &id,
@@ -1515,7 +1515,6 @@ handle_create_transient_display (GdmDBusLocalDisplayFactory *skeleton,
                 gdm_dbus_local_display_factory_complete_create_transient_display (skeleton, invocation, id);
         }
 
-        g_free (id);
         return TRUE;
 }
 


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