[gtk/wip/baedert/for-master: 82/82] gdkdisplay-wayland: Fix a possibly uninitialized out value
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 82/82] gdkdisplay-wayland: Fix a possibly uninitialized out value
- Date: Mon, 20 Apr 2020 18:04:48 +0000 (UTC)
commit 7bebf0cf6332187ff864971832d220ebf6849bcc
Author: Timm Bäder <mail baedert org>
Date: Mon Apr 20 19:44:14 2020 +0200
gdkdisplay-wayland: Fix a possibly uninitialized out value
gdk/wayland/gdkdisplay-wayland.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index e30acdad1b..037af89fdb 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -1287,13 +1287,13 @@ create_shm_pool (struct wl_shm *shm,
fd = open_shared_memory ();
if (fd < 0)
- return NULL;
+ goto fail;
if (ftruncate (fd, size) < 0)
{
g_critical (G_STRLOC ": Truncating shared memory file failed: %m");
close (fd);
- return NULL;
+ goto fail;
}
data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
@@ -1302,7 +1302,7 @@ create_shm_pool (struct wl_shm *shm,
{
g_critical (G_STRLOC ": mmap'ping shared memory file failed: %m");
close (fd);
- return NULL;
+ goto fail;
}
pool = wl_shm_create_pool (shm, fd, size);
@@ -1313,6 +1313,11 @@ create_shm_pool (struct wl_shm *shm,
*buf_length = size;
return pool;
+
+fail:
+ *data_out = NULL;
+ *buf_length = 0;
+ return NULL;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]