aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xext/shm.c')
-rw-r--r--xorg-server/Xext/shm.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/xorg-server/Xext/shm.c b/xorg-server/Xext/shm.c
index 4dad8b6c6..db9d47450 100644
--- a/xorg-server/Xext/shm.c
+++ b/xorg-server/Xext/shm.c
@@ -248,21 +248,20 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
+ void *shmdesc = NULL;
Bool ret;
- if (pPixmap->refcnt == 1) {
- ShmDescPtr shmdesc;
-
- shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
- shmPixmapPrivateKey);
- if (shmdesc)
- ShmDetachSegment((void *) shmdesc, pPixmap->drawable.id);
- }
+ if (pPixmap->refcnt == 1)
+ shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
ret = (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
+
+ if (shmdesc)
+ ShmDetachSegment(shmdesc, pPixmap->drawable.id);
+
return ret;
}
@@ -405,7 +404,7 @@ ProcShmAttach(ClientPtr client)
}
/* The attach was performed with root privs. We must
- * do manual checking of access rights for the credentials
+ * do manual checking of access rights for the credentials
* of the client */
if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
@@ -1148,7 +1147,7 @@ ProcShmAttachFd(ClientPtr client)
fd, 0);
close(fd);
- if ((shmdesc->addr == ((char *) -1))) {
+ if (shmdesc->addr == ((char *) -1)) {
free(shmdesc);
return BadAccess;
}
@@ -1238,7 +1237,7 @@ ProcShmCreateSegment(ClientPtr client)
MAP_SHARED,
fd, 0);
- if ((shmdesc->addr == ((char *) -1))) {
+ if (shmdesc->addr == ((char *) -1)) {
close(fd);
free(shmdesc);
return BadAccess;