[PATCH] composite: set oldpixmap to NULL if we fail to realloc the pixmap.

Dave Airlie airlied at gmail.com
Wed Jun 2 17:16:19 PDT 2010


From: Dave Airlie <airlied at redhat.com>

We don't explicity set the old pixmap to NULL if we fail the realloc, which
later leads to us dereferencing an uninitialised or stale pointer.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 composite/compalloc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 3694ab8..fda22bd 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -632,8 +632,10 @@ compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
     if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
     {
 	pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h);
-	if (!pNew)
+	if (!pNew) {
+	    cw->pOldPixmap = NULL;
 	    return FALSE;
+	}
 	cw->pOldPixmap = pOld;
 	compSetPixmap (pWin, pNew);
     }
-- 
1.6.5.2



More information about the xorg-devel mailing list