From 49835eec0c996ad95a01f0fe340336b6b60e51aa Mon Sep 17 00:00:00 2001 From: Tiago Vignatti Date: Fri, 16 Apr 2010 17:50:43 +0300 Subject: exa: check for NULL pointer before dereferences it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tiago Vignatti Acked-by: Michel Dänzer Reviewed-by: Dan Nicholson --- exa/exa_classic.c | 3 ++- exa/exa_driver.c | 3 ++- exa/exa_mixed.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'exa') diff --git a/exa/exa_classic.c b/exa/exa_classic.c index c31e2d4b3..e1ead6c0d 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -148,7 +148,7 @@ Bool exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, pointer pPixData) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; + ScreenPtr pScreen; ExaScreenPrivPtr pExaScr; ExaPixmapPrivPtr pExaPixmap; Bool ret; @@ -156,6 +156,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept if (!pPixmap) return FALSE; + pScreen = pPixmap->drawable.pScreen; pExaScr = ExaGetScreenPriv(pScreen); pExaPixmap = ExaGetPixmapPriv(pPixmap); diff --git a/exa/exa_driver.c b/exa/exa_driver.c index dcf1a9860..abe79baad 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -126,7 +126,7 @@ Bool exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, pointer pPixData) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; + ScreenPtr pScreen; ExaScreenPrivPtr pExaScr; ExaPixmapPrivPtr pExaPixmap; Bool ret; @@ -134,6 +134,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth if (!pPixmap) return FALSE; + pScreen = pPixmap->drawable.pScreen; pExaScr = ExaGetScreenPriv(pScreen); pExaPixmap = ExaGetPixmapPriv(pPixmap); diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index 21cc3bd13..49e04f22a 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -124,7 +124,7 @@ Bool exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, pointer pPixData) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; + ScreenPtr pScreen; ExaScreenPrivPtr pExaScr; ExaPixmapPrivPtr pExaPixmap; Bool ret, has_gpu_copy; @@ -132,6 +132,7 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, if (!pPixmap) return FALSE; + pScreen = pPixmap->drawable.pScreen; pExaScr = ExaGetScreenPriv(pScreen); pExaPixmap = ExaGetPixmapPriv(pPixmap); -- cgit v1.2.3 From 471f350c99b2e7c5a9045eef5ebff65cd2ddb7c5 Mon Sep 17 00:00:00 2001 From: Tiago Vignatti Date: Mon, 19 Apr 2010 20:34:30 +0300 Subject: exa: don't need to check for NULL pointer if we already assumed it has a value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the alternative would be to check ps in the beginning of the function. Signed-off-by: Tiago Vignatti Acked-by: Michel Dänzer --- exa/exa.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'exa') diff --git a/exa/exa.c b/exa/exa.c index 590d9a500..b2bd1c565 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -779,14 +779,12 @@ exaCloseScreen(int i, ScreenPtr pScreen) unwrap(pExaScr, pScreen, BitmapToRegion); unwrap(pExaScr, pScreen, CreateScreenResources); #ifdef RENDER - if (ps) { - unwrap(pExaScr, ps, Composite); - if (pExaScr->SavedGlyphs) - unwrap(pExaScr, ps, Glyphs); - unwrap(pExaScr, ps, Trapezoids); - unwrap(pExaScr, ps, Triangles); - unwrap(pExaScr, ps, AddTraps); - } + unwrap(pExaScr, ps, Composite); + if (pExaScr->SavedGlyphs) + unwrap(pExaScr, ps, Glyphs); + unwrap(pExaScr, ps, Trapezoids); + unwrap(pExaScr, ps, Triangles); + unwrap(pExaScr, ps, AddTraps); #endif xfree (pExaScr); -- cgit v1.2.3