diff --git a/exa/exa_classic.c b/exa/exa_classic.c index 006b3862d..eff3bb811 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -98,10 +98,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; if (pExaPixmap->fb_pitch > 131071) { - swap(pExaScr, pScreen, DestroyPixmap); - if (pScreen->DestroyPixmap) - pScreen->DestroyPixmap(pPixmap); - swap(pExaScr, pScreen, DestroyPixmap); + dixDestroyPixmap(pPixmap, 0); return NULL; } @@ -111,10 +108,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, pScreen, pPixmap); if (pExaPixmap->pDamage == NULL) { - swap(pExaScr, pScreen, DestroyPixmap); - if (pScreen->DestroyPixmap) - pScreen->DestroyPixmap(pPixmap); - swap(pExaScr, pScreen, DestroyPixmap); + dixDestroyPixmap(pPixmap, 0); return NULL; } @@ -220,6 +214,8 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); + if (!pExaPixmap) // we're called on an error path + goto out; exaDestroyPixmap(pPixmap); @@ -237,6 +233,7 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap) RegionUninit(&pExaPixmap->validFB); } +out: swap(pExaScr, pScreen, DestroyPixmap); if (pScreen->DestroyPixmap) ret = pScreen->DestroyPixmap(pPixmap); diff --git a/exa/exa_driver.c b/exa/exa_driver.c index f7c2e5d28..1be0606f0 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -100,10 +100,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, } if (!pExaPixmap->driverPriv) { - swap(pExaScr, pScreen, DestroyPixmap); - if (pScreen->DestroyPixmap) - pScreen->DestroyPixmap(pPixmap); - swap(pExaScr, pScreen, DestroyPixmap); + dixDestroyPixmap(pPixmap, 0); return NULL; } @@ -198,6 +195,8 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); + if (!pExaPixmap) // we're called on an error path + goto out; exaDestroyPixmap(pPixmap); @@ -206,6 +205,7 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap) pExaPixmap->driverPriv = NULL; } +out: swap(pExaScr, pScreen, DestroyPixmap); if (pScreen->DestroyPixmap) ret = pScreen->DestroyPixmap(pPixmap); diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index cda15e7f7..0606cfde9 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -251,6 +251,8 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); + if (!pExaPixmap) + goto out; // we're called on an error path exaDestroyPixmap(pPixmap); @@ -268,6 +270,7 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) } } +out: swap(pExaScr, pScreen, DestroyPixmap); if (pScreen->DestroyPixmap) ret = pScreen->DestroyPixmap(pPixmap);