summaryrefslogtreecommitdiff
path: root/mate-session/main.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-10-23 11:18:52 +0200
committerraveit65 <[email protected]>2023-04-16 14:32:03 +0200
commit126338497f92267b2ffab1effbdf7416f1fad879 (patch)
tree6cf5044368a3cd47cb8caa896f23a032f11380c0 /mate-session/main.c
parentade769d7a5a577d6a7936c75fac1867df9ad719e (diff)
downloadmate-session-manager-126338497f92267b2ffab1effbdf7416f1fad879.tar.bz2
mate-session-manager-126338497f92267b2ffab1effbdf7416f1fad879.tar.xz
mate-session: fix memory leak
Diffstat (limited to 'mate-session/main.c')
-rw-r--r--mate-session/main.c11
1 files changed, 6 insertions, 5 deletions
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();