summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2009-08-07 20:04:53 +0200
committerMaarten Maathuis <madman2003@gmail.com>2009-08-07 20:38:14 +0200
commit1548e8ae5d28ed0eb6057a1a19cfc84a78ef34dc (patch)
treea969453cf4e7b4799340e71a749a6a751ed21ed3 /exa
parente94c7c42ce9d6a194b76ba7e8b3904b180f93a1b (diff)
exa: fix a potential loophole in "mixed"
- Always free sys_ptr before setting the pixmap to pinned.
Diffstat (limited to 'exa')
-rw-r--r--exa/exa_mixed.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 47fa6d448..0d2552d8b 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -145,20 +145,22 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
pExaPixmap = ExaGetPixmapPriv(pPixmap);
if (pExaPixmap) {
- if (pPixData) {
- if (!exaPixmapIsPinned(pPixmap)) {
- free(pExaPixmap->sys_ptr);
-
- /* We no longer need this. */
- if (pExaPixmap->pDamage) {
- DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
- DamageDestroy(pExaPixmap->pDamage);
- pExaPixmap->pDamage = NULL;
- }
+ if (!exaPixmapIsPinned(pPixmap)) {
+ free(pExaPixmap->sys_ptr);
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr = NULL;
+ pExaPixmap->sys_pitch = pPixmap->devKind = 0;
+
+ /* We no longer need this. */
+ if (pExaPixmap->pDamage) {
+ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageDestroy(pExaPixmap->pDamage);
+ pExaPixmap->pDamage = NULL;
}
- pExaPixmap->sys_ptr = pPixData;
}
+ if (pPixData)
+ pExaPixmap->sys_ptr = pPixData;
+
if (devKind > 0)
pExaPixmap->sys_pitch = devKind;