glx: fix shared memory leak in X11
authorRay Zhang <zhanglei002@gmail.com>
Wed, 27 Feb 2019 06:54:05 +0000 (06:54 +0000)
committerDave Airlie <airlied@redhat.com>
Thu, 28 Feb 2019 04:23:02 +0000 (14:23 +1000)
call XShmDetach to allow X server to free shared memory

Fixes: bcd80be49a8260c2233d "drisw/glx: use XShm if possible"
Signed-off-by: Ray Zhang <zhanglei002@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/glx/drisw_glx.c

index 00c7fa100ab2a4b589bfb2c4bafeee37440b5c10..48c03ca42e0342b831ce3b8d87fffb6f0cf40341 100644 (file)
@@ -147,6 +147,9 @@ XDestroyDrawable(struct drisw_drawable * pdp, Display * dpy, XID drawable)
    if (pdp->ximage)
       XDestroyImage(pdp->ximage);
 
+   if (pdp->shminfo.shmid > 0)
+      XShmDetach(dpy, &pdp->shminfo);
+
    free(pdp->visinfo);
 
    XFreeGC(dpy, pdp->gc);