summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-02-21 15:58:56 +1000
committerDave Airlie <airlied@redhat.com>2008-02-22 13:49:51 +1000
commitfad1db2d73f8dd95f17db10c7ea381c7774e3c29 (patch)
tree7e2db55efe5dac132b3238a629aac8131fe9df36 /linux-core
parentcdad850ebc3570e5ff5a0996f36832c965aa8a1d (diff)
modesetting: fix memory leak and misallocation
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_crtc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index ebd15c5e..bf37730b 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -1092,7 +1092,8 @@ int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info,
struct drm_output *output;
int count = 0, ro;
- save_crtcs = kzalloc(dev->mode_config.num_crtc * sizeof(struct drm_crtc *), GFP_KERNEL);
+ /* this is meant to be num_output not num_crtc */
+ save_crtcs = kzalloc(dev->mode_config.num_output * sizeof(struct drm_crtc *), GFP_KERNEL);
if (!save_crtcs)
return -ENOMEM;
@@ -1663,10 +1664,10 @@ int drm_mode_setcrtc(struct drm_device *dev,
}
}
- /* What happens to output_set, leak? */
ret = drm_crtc_set_config(crtc, crtc_req, mode, output_set, fb);
out:
+ kfree(output_set);
mutex_unlock(&dev->mode_config.mutex);
return ret;
}