From 68f0872db6ec4d5dc3b524ee08ecad0aa125acd9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 5 Aug 2008 22:36:03 -0700 Subject: [PATCH] [uxa] Check xalloc returns and deal with failure Failing xalloc in a rendering function means just dropping the drawing on the floor (that's what we've always done). --- uxa/uxa-accel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c index edc68f2a..b25a8faa 100644 --- a/uxa/uxa-accel.c +++ b/uxa/uxa-accel.c @@ -508,6 +508,8 @@ uxa_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, } prect = xalloc(sizeof(xRectangle) * npt); + if (!prect) + return; for (i = 0; i < npt; i++) { prect[i].x = ppt[i].x; prect[i].y = ppt[i].y; @@ -543,6 +545,8 @@ uxa_poly_lines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, } prect = xalloc(sizeof(xRectangle) * (npt - 1)); + if (!prect) + return; x1 = ppt[0].x; y1 = ppt[0].y; /* If we have any non-horizontal/vertical, fall back. */ @@ -612,6 +616,8 @@ uxa_poly_segment (DrawablePtr pDrawable, GCPtr pGC, int nseg, } prect = xalloc(sizeof(xRectangle) * nseg); + if (!prect) + return; for (i = 0; i < nseg; i++) { if (pSeg[i].x1 < pSeg[i].x2) { prect[i].x = pSeg[i].x1;