Mesa (staging/19.1): drisw: Fix shared memory leak on drawable resize

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Sep 30 08:43:06 UTC 2019


Module: Mesa
Branch: staging/19.1
Commit: ddc7d7a33b36c2305955bbffb1f295196c1a9669
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddc7d7a33b36c2305955bbffb1f295196c1a9669

Author: Andreas Gottschling <andreasgottschling at outlook.de>
Date:   Fri Sep 27 12:02:06 2019 -0400

drisw: Fix shared memory leak on drawable resize

XDestroyImage will mark the segment as to-be-destroyed, but it will
persist until we detach it, and we weren't doing so.

Cc: mesa-stable at lists.freedesktop.org
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/121
Reviewed-by: Adam Jackson <ajax at redhat.com>
(cherry picked from commit c5a2ccec5e9fa60bbec5e7b574877f8af4c14462)

---

 src/glx/drisw_glx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index f38dbbca2df..39b484b2daa 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -86,6 +86,8 @@ XCreateDrawable(struct drisw_drawable * pdp, int shmid, Display * dpy)
    if (pdp->ximage) {
       XDestroyImage(pdp->ximage);
       pdp->ximage = NULL;
+      if ((pdp->shminfo.shmid > 0) && (shmid != pdp->shminfo.shmid))
+         XShmDetach(dpy, &pdp->shminfo);
    }
 
    if (!xshm_error && shmid >= 0) {




More information about the mesa-commit mailing list