[mutter] wayland: Don't free non-transferred string when cleaning up
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Don't free non-transferred string when cleaning up
- Date: Mon, 4 Sep 2017 08:28:24 +0000 (UTC)
commit 807658e9725bd8d3693e3a7178c72546b8835e63
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Sep 4 12:32:53 2017 +0800
wayland: Don't free non-transferred string when cleaning up
When cleaning up the display name string management, the display name
string retrieved from libwayland-server was also passed to free() on
clean up. This is invalid as the display name string ownership is not
transferred to us. Fix this by strdup:ing the string before saving it.
https://bugzilla.gnome.org/show_bug.cgi?id=730551
src/wayland/meta-wayland.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 716b7f3..2c3dff2 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -376,10 +376,13 @@ meta_wayland_init (void)
}
else
{
- compositor->display_name =
- wl_display_add_socket_auto (compositor->wayland_display);
- if (compositor->display_name == NULL)
+ const char *display_name;
+
+ display_name = wl_display_add_socket_auto (compositor->wayland_display);
+ if (!display_name)
g_error ("Failed to create socket");
+
+ compositor->display_name = g_strdup (display_name);
}
set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]