summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-07-28 09:32:59 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2008-07-28 09:32:59 +0200
commit6ab8d6010adfd5ad6f1e1094a26c84f0aff934b1 (patch)
treebe6f9086f3b128d1f59f76adf2a640369dee0937 /glx
parentb3e981c9d4ff31263a43b47f83cf8db4c2b5aeff (diff)
AIGLX/DRI1: Pay more attention to return value from DRIGetDrawableInfo().
Could have crashed otherwise if the num(Back)ClipRects variables referenced by the caller weren't pre-initialized to 0.
Diffstat (limited to 'glx')
-rw-r--r--glx/glxdri.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 41c47a8c8..8ae56edcd 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -740,7 +740,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
numBackClipRects, &pBackClipRects);
__glXleaveServer(GL_FALSE);
- if (*numClipRects > 0) {
+ if (retval && *numClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numClipRects;
*ppClipRects = xalloc (size);
@@ -771,16 +771,20 @@ getDrawableInfo(__DRIdrawable *driDrawable,
}
else {
*ppClipRects = NULL;
+ *numClipRects = 0;
}
- if (*numBackClipRects > 0) {
+ if (retval && *numBackClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numBackClipRects;
*ppBackClipRects = xalloc (size);
if (*ppBackClipRects != NULL)
memcpy (*ppBackClipRects, pBackClipRects, size);
+ else
+ *numBackClipRects = 0;
}
else {
*ppBackClipRects = NULL;
+ *numBackClipRects = 0;
}
return retval;