exa: check for NULL pointer before dereferences it

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Acked-by: Michel Dänzer <michel@daenzer.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
This commit is contained in:
Tiago Vignatti 2010-04-16 17:50:43 +03:00
parent 996c115deb
commit 49835eec0c
3 changed files with 6 additions and 3 deletions

View File

@ -148,7 +148,7 @@ Bool
exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth, exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData) int bitsPerPixel, int devKind, pointer pPixData)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen; ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr; ExaScreenPrivPtr pExaScr;
ExaPixmapPrivPtr pExaPixmap; ExaPixmapPrivPtr pExaPixmap;
Bool ret; Bool ret;
@ -156,6 +156,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept
if (!pPixmap) if (!pPixmap)
return FALSE; return FALSE;
pScreen = pPixmap->drawable.pScreen;
pExaScr = ExaGetScreenPriv(pScreen); pExaScr = ExaGetScreenPriv(pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap); pExaPixmap = ExaGetPixmapPriv(pPixmap);

View File

@ -126,7 +126,7 @@ Bool
exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth, exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData) int bitsPerPixel, int devKind, pointer pPixData)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen; ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr; ExaScreenPrivPtr pExaScr;
ExaPixmapPrivPtr pExaPixmap; ExaPixmapPrivPtr pExaPixmap;
Bool ret; Bool ret;
@ -134,6 +134,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth
if (!pPixmap) if (!pPixmap)
return FALSE; return FALSE;
pScreen = pPixmap->drawable.pScreen;
pExaScr = ExaGetScreenPriv(pScreen); pExaScr = ExaGetScreenPriv(pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap); pExaPixmap = ExaGetPixmapPriv(pPixmap);

View File

@ -124,7 +124,7 @@ Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData) int bitsPerPixel, int devKind, pointer pPixData)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen; ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr; ExaScreenPrivPtr pExaScr;
ExaPixmapPrivPtr pExaPixmap; ExaPixmapPrivPtr pExaPixmap;
Bool ret, has_gpu_copy; Bool ret, has_gpu_copy;
@ -132,6 +132,7 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
if (!pPixmap) if (!pPixmap)
return FALSE; return FALSE;
pScreen = pPixmap->drawable.pScreen;
pExaScr = ExaGetScreenPriv(pScreen); pExaScr = ExaGetScreenPriv(pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap); pExaPixmap = ExaGetPixmapPriv(pPixmap);