exa: fix a potential loophole in "mixed"

- Always free sys_ptr before setting the pixmap to pinned.
This commit is contained in:
Maarten Maathuis 2009-08-07 20:04:53 +02:00
parent e94c7c42ce
commit 1548e8ae5d

View File

@ -145,9 +145,10 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
pExaPixmap = ExaGetPixmapPriv(pPixmap); pExaPixmap = ExaGetPixmapPriv(pPixmap);
if (pExaPixmap) { if (pExaPixmap) {
if (pPixData) {
if (!exaPixmapIsPinned(pPixmap)) { if (!exaPixmapIsPinned(pPixmap)) {
free(pExaPixmap->sys_ptr); free(pExaPixmap->sys_ptr);
pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr = NULL;
pExaPixmap->sys_pitch = pPixmap->devKind = 0;
/* We no longer need this. */ /* We no longer need this. */
if (pExaPixmap->pDamage) { if (pExaPixmap->pDamage) {
@ -156,8 +157,9 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
pExaPixmap->pDamage = NULL; pExaPixmap->pDamage = NULL;
} }
} }
if (pPixData)
pExaPixmap->sys_ptr = pPixData; pExaPixmap->sys_ptr = pPixData;
}
if (devKind > 0) if (devKind > 0)
pExaPixmap->sys_pitch = devKind; pExaPixmap->sys_pitch = devKind;