diff options
author | TSUKAHARA Ken <ken3@nurs.or.jp> | 2017-01-20 00:21:39 +0900 |
---|---|---|
committer | TSUKAHARA Ken <ken3@nurs.or.jp> | 2017-01-20 00:21:39 +0900 |
commit | 1d2556fb31a32604cebad3915531a9ddcb53ad89 (patch) | |
tree | d4db1bbc0792f92ab29e645fbcff68e2eb872642 | |
parent | d5ab3e376f00e4237a90732f1dd0b5c71e0693de (diff) | |
download | tigervnc-1d2556fb31a32604cebad3915531a9ddcb53ad89.tar.gz tigervnc-1d2556fb31a32604cebad3915531a9ddcb53ad89.zip |
Fix for shared memory leakage.
-rw-r--r-- | vncviewer/X11PixelBuffer.cxx | 6 |
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; |