emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 4a2a1eb: Avoid possible NULL pointer dereference fo


From: Dmitry Antipov
Subject: [Emacs-diffs] master 4a2a1eb: Avoid possible NULL pointer dereference found by GCC 6.1.1
Date: Wed, 29 Jun 2016 04:52:15 +0000 (UTC)

branch: master
commit 4a2a1eba09e5bbc37b853733708feae17f1425f5
Author: Dmitry Antipov <address@hidden>
Commit: Dmitry Antipov <address@hidden>

    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.
---
 src/xfns.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 1120c33..265eb6c 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4295,8 +4295,8 @@ x_get_monitor_attributes_xrandr (struct x_display_info 
*dpyinfo)
     {
       XRROutputInfo *info = XRRGetOutputInfo (dpy, resources,
                                               resources->outputs[i]);
-      Connection conn = info ? info->connection : RR_Disconnected;
-      RRCrtc id = info ? info->crtc : None;
+      if (!info)
+       continue;
 
       if (strcmp (info->name, "default") == 0)
         {
@@ -4307,9 +4307,9 @@ x_get_monitor_attributes_xrandr (struct x_display_info 
*dpyinfo)
           return Qnil;
         }
 
-      if (conn != RR_Disconnected && id != None)
+      if (info->connection != RR_Disconnected && info->crtc != None)
         {
-          XRRCrtcInfo *crtc = XRRGetCrtcInfo (dpy, resources, id);
+          XRRCrtcInfo *crtc = XRRGetCrtcInfo (dpy, resources, info->crtc);
           struct MonitorInfo *mi = &monitors[i];
           XRectangle workarea_r;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]