diff options
author | Dave Airlie <airlied@redhat.com> | 2012-09-17 11:48:14 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-09-17 11:48:14 +1000 |
commit | 07e4b5c5e766d06a91178a0ff7589c842ee509fb (patch) | |
tree | 0417328f44b37766558eb4eecbf52e3ff1e3413c | |
parent | fcf9ddf3c6ddb531020b532123118ab0216e6e65 (diff) |
modesetting: remove alloca usage again
this slipped back in.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | src/driver.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/driver.c b/src/driver.c index 38a1c09..200a6d8 100644 --- a/src/driver.c +++ b/src/driver.c @@ -428,10 +428,13 @@ static int dispatch_dirty_region(ScrnInfoPtr scrn, 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; + if (!clip) + return -ENOMEM; + /* XXX no need for copy? */ for (i = 0; i < num_cliprects; i++, rect++) { clip[i].x1 = rect->x1; @@ -442,6 +445,7 @@ static int dispatch_dirty_region(ScrnInfoPtr scrn, /* TODO query connector property to see if this is needed */ ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects); + free(clip); DamageEmpty(damage); if (ret) { if (ret == -EINVAL) |