diff options
author | rbuj <[email protected]> | 2021-10-23 11:18:52 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-04-16 14:32:03 +0200 |
commit | 126338497f92267b2ffab1effbdf7416f1fad879 (patch) | |
tree | 6cf5044368a3cd47cb8caa896f23a032f11380c0 /mate-session | |
parent | ade769d7a5a577d6a7936c75fac1867df9ad719e (diff) | |
download | mate-session-manager-126338497f92267b2ffab1effbdf7416f1fad879.tar.bz2 mate-session-manager-126338497f92267b2ffab1effbdf7416f1fad879.tar.xz |
mate-session: fix memory leak
Diffstat (limited to 'mate-session')
-rw-r--r-- | mate-session/gsm-manager.c | 8 | ||||
-rw-r--r-- | mate-session/main.c | 11 |
2 files changed, 12 insertions, 7 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c index 6fa2722..37ca39d 100644 --- a/mate-session/gsm-manager.c +++ b/mate-session/gsm-manager.c @@ -144,7 +144,7 @@ typedef struct { GSettings *settings_lockdown; GSettings *settings_screensaver; - const char *renderer; + char *renderer; DBusGProxy *bus_proxy; DBusGConnection *connection; @@ -1695,7 +1695,8 @@ _gsm_manager_set_renderer (GsmManager *manager, { GsmManagerPrivate *priv; priv = gsm_manager_get_instance_private (manager); - priv->renderer = renderer; + g_free (priv->renderer); + priv->renderer = g_strdup (renderer); } static gboolean @@ -2656,6 +2657,9 @@ gsm_manager_dispose (GObject *object) g_object_unref (priv->settings_screensaver); priv->settings_screensaver = NULL; } + + g_clear_pointer (&priv->renderer, g_free); + G_OBJECT_CLASS (gsm_manager_parent_class)->dispose (object); } diff --git a/mate-session/main.c b/mate-session/main.c index 96c1092..fc2148e 100644 --- a/mate-session/main.c +++ b/mate-session/main.c @@ -83,7 +83,6 @@ static gboolean failsafe = FALSE; static gboolean show_version = FALSE; static gboolean debug = FALSE; static gboolean disable_acceleration_check = FALSE; -static char *gl_renderer = NULL; static gboolean initialize_gsettings (void) @@ -575,7 +574,7 @@ static void set_overlay_scroll (void) } static gboolean -check_gl (GError **error) +check_gl (gchar **gl_renderer, GError **error) { int status; char *argv[] = { LIBEXECDIR "/mate-session-check-accelerated", NULL }; @@ -585,7 +584,7 @@ check_gl (GError **error) return TRUE; } - if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, &gl_renderer, NULL, + if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, gl_renderer, NULL, &status, error)) { return FALSE; } @@ -605,6 +604,7 @@ int main(int argc, char** argv) GSettings* accessibility_settings; MdmSignalHandler* signal_handler; static char** override_autostart_dirs = NULL; + char* gl_renderer = NULL; gboolean gl_failed = FALSE; static GOptionEntry entries[] = { @@ -670,7 +670,7 @@ int main(int argc, char** argv) g_debug ("hardware acceleration check is disabled"); } else { /* Check GL, if it doesn't work out then force software fallback */ - if (!check_gl (&error)) { + if (!check_gl (&gl_renderer, &error)) { gl_failed = TRUE; g_debug ("hardware acceleration check failed: %s", @@ -678,7 +678,7 @@ int main(int argc, char** argv) g_clear_error (&error); if (g_getenv ("LIBGL_ALWAYS_SOFTWARE") == NULL) { g_setenv ("LIBGL_ALWAYS_SOFTWARE", "1", TRUE); - if (!check_gl (&error)) { + if (!check_gl (&gl_renderer, &error)) { g_warning ("software acceleration check failed: %s", error? error->message : ""); g_clear_error (&error); @@ -759,6 +759,7 @@ int main(int argc, char** argv) gsm_xsmp_server_start(xsmp_server); _gsm_manager_set_renderer (manager, gl_renderer); + g_free (gl_renderer); gsm_manager_start(manager); gtk_main(); |