summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-08-05 22:36:03 -0700
committerKeith Packard <keithp@keithp.com>2008-08-05 22:36:03 -0700
commit68f0872db6ec4d5dc3b524ee08ecad0aa125acd9 (patch)
treef779dc9fed2c707d3b8b3da72eeb03efbe1d138c
parent8f10bfb127bfe73d83d58f1f306fb9a4dfd825d6 (diff)
[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).
-rw-r--r--uxa/uxa-accel.c6
1 files changed, 6 insertions, 0 deletions
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;