From 6ab8d6010adfd5ad6f1e1094a26c84f0aff934b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 28 Jul 2008 09:32:59 +0200 Subject: [PATCH] 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. --- glx/glxdri.c | 8 ++++++-- 1 file 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;