diff --git a/exa/exa_classic.c b/exa/exa_classic.c index 7f93f1e3d..7be8b9fa9 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -96,10 +96,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; } @@ -109,10 +106,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; } @@ -218,6 +212,8 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); + if (!pExaPixmap) // we're called on an error path + goto out; exaDestroyPixmap(pPixmap); @@ -235,6 +231,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 17106fcb9..1896d87fe 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -98,10 +98,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; } @@ -196,6 +193,8 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); + if (!pExaPixmap) // we're called on an error path + goto out; exaDestroyPixmap(pPixmap); @@ -204,6 +203,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 7138f9b30..68f23beb5 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -249,6 +249,8 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap); + if (!pExaPixmap) + goto out; // we're called on an error path exaDestroyPixmap(pPixmap); @@ -266,6 +268,7 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) } } +out: swap(pExaScr, pScreen, DestroyPixmap); if (pScreen->DestroyPixmap) ret = pScreen->DestroyPixmap(pPixmap);