From bea481803020412ba5583c040516932870e7d3d3 Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Sat, 8 Sep 2018 18:00:19 +0200 Subject: [PATCH] X11: Add NULL checks in work area retrieval Related to #1322. --- src/x11_monitor.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/x11_monitor.c b/src/x11_monitor.c index d0aa9f9c..e924d366 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -350,10 +350,15 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos _glfwGetWindowPropertyX11(_glfw.x11.root, _glfw.x11.NET_WORKAREA, XA_CARDINAL, (unsigned char**) &extents); - *xpos = extents[0]; - *ypos = extents[1]; - *width = extents[2]; - *height = extents[3]; + if (xpos) + *xpos = extents[0]; + if (xpos) + *ypos = extents[1]; + if (xpos) + *width = extents[2]; + if (xpos) + *height = extents[3]; + XFree(extents); } }