[PATCH] exa: check for NULL pointer before dereferences it

Tiago Vignatti tiago.vignatti at nokia.com
Fri Apr 16 08:42:20 PDT 2010


Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 exa/exa_classic.c |    3 ++-
 exa/exa_driver.c  |    4 +++-
 exa/exa_mixed.c   |    3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/exa/exa_classic.c b/exa/exa_classic.c
index c31e2d4..e1ead6c 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 dcf1a98..25254c9 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,8 @@ 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 21cc3bd..49e04f2 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);
 
-- 
1.6.0.4



More information about the xorg-devel mailing list