From 6c1b5cb903f2ff9cb915273835c301d6ac255f45 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 14 Apr 2012 15:01:16 +0100 Subject: [PATCH] drop use of alloca, just use malloc/free Reported-by: Alan Coopersmith Signed-off-by: Dave Airlie --- hw/xfree86/drivers/modesetting/driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index 87431ff43..95d6b908d 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -324,7 +324,7 @@ static void dispatch_dirty(ScreenPtr pScreen) unsigned num_cliprects = REGION_NUM_RECTS(dirty); if (num_cliprects) { - drmModeClip *clip = alloca(num_cliprects * sizeof(drmModeClip)); + drmModeClip *clip = malloc(num_cliprects * sizeof(drmModeClip)); BoxPtr rect = REGION_RECTS(dirty); int i, ret; @@ -338,6 +338,7 @@ static void dispatch_dirty(ScreenPtr pScreen) /* TODO query connector property to see if this is needed */ ret = drmModeDirtyFB(ms->fd, ms->drmmode.fb_id, clip, num_cliprects); + free(clip); if (ret) { if (ret == -EINVAL || ret == -ENOSYS) { ms->dirty_enabled = FALSE;