From: Tim Waugh Date: Fri, 17 Oct 2014 09:28:55 +0000 (+0100) Subject: Check the return value from XShmAttach. X-Git-Tag: v1.3.90~21^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F48%2Fhead;p=tigervnc.git Check the return value from XShmAttach. --- 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);