aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2017-01-19 17:04:20 +0100
committerPierre Ossman <ossman@cendio.se>2017-01-19 17:04:20 +0100
commit143f239afac50f88b2e108ca085e32ad90e1e2ff (patch)
treec728e71aa712763af60777b0fd38f63051e2aebf
parent3de00098d0baadc74f1390855148ebd7a3226218 (diff)
parent1d2556fb31a32604cebad3915531a9ddcb53ad89 (diff)
downloadtigervnc-143f239afac50f88b2e108ca085e32ad90e1e2ff.tar.gz
tigervnc-143f239afac50f88b2e108ca085e32ad90e1e2ff.zip
Merge branch 'master' of https://github.com/ken3/tigervnc
-rw-r--r--vncviewer/X11PixelBuffer.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx
index 4f52cad1..e23f7771 100644
--- a/vncviewer/X11PixelBuffer.cxx
+++ b/vncviewer/X11PixelBuffer.cxx
@@ -187,8 +187,9 @@ int X11PixelBuffer::setupShm()
goto free_xim;
shminfo->shmaddr = xim->data = (char*)shmat(shminfo->shmid, 0, 0);
+ shmctl(shminfo->shmid, IPC_RMID, 0); // to avoid memory leakage
if (shminfo->shmaddr == (char *)-1)
- goto free_shm;
+ goto free_xim;
shminfo->readOnly = True;
@@ -216,9 +217,6 @@ int X11PixelBuffer::setupShm()
free_shmaddr:
shmdt(shminfo->shmaddr);
-free_shm:
- shmctl(shminfo->shmid, IPC_RMID, 0);
-
free_xim:
XDestroyImage(xim);
xim = NULL;