aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2016-06-29 07:46:59 +0300
committerDmitry Antipov2016-06-29 07:46:59 +0300
commit4a2a1eba09e5bbc37b853733708feae17f1425f5 (patch)
treee224c9d25d44cfeaae48e3b8aef67e6563c300db
parent1a5d0c15185986e645e8fb8080a2338d8f17d562 (diff)
downloademacs-4a2a1eba09e5bbc37b853733708feae17f1425f5.tar.gz
emacs-4a2a1eba09e5bbc37b853733708feae17f1425f5.zip
Avoid possible NULL pointer dereference found by GCC 6.1.1
* src/xfns.c (x_get_monitor_attributes_xrandr): Always check the value returned by XRRGetOutputInfo.
-rw-r--r--src/xfns.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 1120c330e8b..265eb6c65ac 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4295,8 +4295,8 @@ x_get_monitor_attributes_xrandr (struct x_display_info *dpyinfo)
4295 { 4295 {
4296 XRROutputInfo *info = XRRGetOutputInfo (dpy, resources, 4296 XRROutputInfo *info = XRRGetOutputInfo (dpy, resources,
4297 resources->outputs[i]); 4297 resources->outputs[i]);
4298 Connection conn = info ? info->connection : RR_Disconnected; 4298 if (!info)
4299 RRCrtc id = info ? info->crtc : None; 4299 continue;
4300 4300
4301 if (strcmp (info->name, "default") == 0) 4301 if (strcmp (info->name, "default") == 0)
4302 { 4302 {
@@ -4307,9 +4307,9 @@ x_get_monitor_attributes_xrandr (struct x_display_info *dpyinfo)
4307 return Qnil; 4307 return Qnil;
4308 } 4308 }
4309 4309
4310 if (conn != RR_Disconnected && id != None) 4310 if (info->connection != RR_Disconnected && info->crtc != None)
4311 { 4311 {
4312 XRRCrtcInfo *crtc = XRRGetCrtcInfo (dpy, resources, id); 4312 XRRCrtcInfo *crtc = XRRGetCrtcInfo (dpy, resources, info->crtc);
4313 struct MonitorInfo *mi = &monitors[i]; 4313 struct MonitorInfo *mi = &monitors[i];
4314 XRectangle workarea_r; 4314 XRectangle workarea_r;
4315 4315