summaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorTim Waugh <twaugh@redhat.com>2014-10-17 10:28:55 +0100
committerTim Waugh <twaugh@redhat.com>2014-10-17 10:28:55 +0100
commit7c56b4c332c2bfadc851375b0d38b6991ea81a7a (patch)
treeeedff1511f164470543799383852595bed3f7ea9 /vncviewer
parentb17c9c4dedf09873b10b3c23d5f189aa9eba6978 (diff)
downloadtigervnc-7c56b4c332c2bfadc851375b0d38b6991ea81a7a.tar.gz
tigervnc-7c56b4c332c2bfadc851375b0d38b6991ea81a7a.zip
Check the return value from XShmAttach.
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/X11PixelBuffer.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx
index f83aa5f4..a7794277 100644
--- a/vncviewer/X11PixelBuffer.cxx
+++ b/vncviewer/X11PixelBuffer.cxx
@@ -189,7 +189,11 @@ int X11PixelBuffer::setupShm()
caughtError = false;
old_handler = XSetErrorHandler(XShmAttachErrorHandler);
- XShmAttach(fl_display, shminfo);
+ if (!XShmAttach(fl_display, shminfo)) {
+ XSetErrorHandler(old_handler);
+ goto free_shmaddr;
+ }
+
XSync(fl_display, False);
XSetErrorHandler(old_handler);