Skip to content

Commit

Permalink
Fix shared memory leak
Browse files Browse the repository at this point in the history
The MIT-SHM documentation:
  https://www.x.org/releases/X11R7.7/doc/xextproto/shm.html
says to run XShmDetach() first, and then to destroy the segment.

(cherry picked from commit 585ee24)
  • Loading branch information
adamhalim committed Jan 26, 2024
1 parent 973a8a2 commit 43d844e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unix/x0vncserver/Image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ void ShmImage::Init(int width, int height, const XVisualInfo *vinfo)

ShmImage::~ShmImage()
{
// FIXME: Destroy image as described in MIT-SHM documentation.
if (shminfo != NULL) {
XShmDetach(dpy, shminfo);
shmdt(shminfo->shmaddr);
shmctl(shminfo->shmid, IPC_RMID, 0);
delete shminfo;
Expand Down

0 comments on commit 43d844e

Please sign in to comment.