drm: Set cliprects to NULL when changing drawable to having 0 cliprects.

This avoids setting the cliprects pointer to a zero-sized allocation.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Zhenyu Wang 2008-10-17 13:15:48 +08:00 committed by Dave Airlie
parent e9d21d7f5a
commit 863842736f
1 changed files with 3 additions and 1 deletions

View File

@ -111,7 +111,9 @@ int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file
switch (update->type) {
case DRM_DRAWABLE_CLIPRECTS:
if (update->num != info->num_rects) {
if (update->num == 0)
rects = NULL;
else if (update->num != info->num_rects) {
rects = drm_alloc(update->num * sizeof(struct drm_clip_rect),
DRM_MEM_BUFS);
} else