diff options
author | Iain Lane <iain.lane@canonical.com> | 2016-09-29 16:36:55 +0100 |
---|---|---|
committer | Iain Lane <iain.lane@canonical.com> | 2016-09-29 16:36:55 +0100 |
commit | c4d4d8759ff25db5f332c3aa2c0fe5e0ad7c317c (patch) | |
tree | 6353d443e1b7e4d267c1b5404edd033052775da6 | |
parent | 61ac4b749c61f50f3c205810bd74fb0fb86d4c38 (diff) |
Don't leak current_desktops
(bzr r648.1.2)
-rw-r--r-- | src/bamf-legacy-screen.c | 8 | ||||
-rw-r--r-- | src/bamf-matcher.c | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/bamf-legacy-screen.c b/src/bamf-legacy-screen.c index f6a77f97..f50f4854 100644 --- a/src/bamf-legacy-screen.c +++ b/src/bamf-legacy-screen.c @@ -580,7 +580,7 @@ bamf_legacy_screen_get_default () { BamfLegacyScreen *self; Display *dpy; - const gchar * const *current_desktops = NULL; + gchar **current_desktops = NULL; const gchar *xdg_current_desktop; if (static_screen) @@ -618,15 +618,17 @@ bamf_legacy_screen_get_default () xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); if (xdg_current_desktop) - current_desktops = (const gchar * const *) g_strsplit (xdg_current_desktop, ":", 0); + current_desktops = g_strsplit (xdg_current_desktop, ":", 0); - if (current_desktops && g_strv_contains (current_desktops, "Unity")) + if (current_desktops && g_strv_contains ((const gchar * const *) current_desktops, "Unity")) { _COMPIZ_TOOLKIT_ACTION = XInternAtom (dpy, "_COMPIZ_TOOLKIT_ACTION", False); _COMPIZ_TOOLKIT_ACTION_WINDOW_MENU = XInternAtom (dpy, "_COMPIZ_TOOLKIT_ACTION_WINDOW_MENU", False); gdk_window_add_filter (NULL, filter_compiz_messages, self); } + g_strfreev (current_desktops); + return static_screen; } diff --git a/src/bamf-matcher.c b/src/bamf-matcher.c index 23c35765..e686ec56 100644 --- a/src/bamf-matcher.c +++ b/src/bamf-matcher.c @@ -942,7 +942,7 @@ load_index_file_to_table (BamfMatcher * self, GDataInputStream *input; char *line; char *directory; - const gchar * const *current_desktops = NULL; + gchar **current_desktops = NULL; const gchar *xdg_current_desktop; gsize length; @@ -963,7 +963,7 @@ load_index_file_to_table (BamfMatcher * self, xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); if (xdg_current_desktop) - current_desktops = (const gchar * const *) g_strsplit (xdg_current_desktop, ":", 0); + current_desktops = g_strsplit (xdg_current_desktop, ":", 0); directory = g_path_get_dirname (index_file); input = g_data_input_stream_new (G_INPUT_STREAM (stream)); @@ -990,7 +990,7 @@ load_index_file_to_table (BamfMatcher * self, for (i = 0; sub_parts[i]; ++i) { - if (g_strv_contains (current_desktops, sub_parts[i]) == 0) + if (g_strv_contains ((const gchar * const *) current_desktops, sub_parts[i]) == 0) { found_current = TRUE; break; @@ -1041,6 +1041,7 @@ load_index_file_to_table (BamfMatcher * self, g_object_unref (input); g_object_unref (stream); g_object_unref (file); + g_strfreev (current_desktops); g_free (directory); } |