diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2012-03-13 11:35:43 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-03-15 10:50:20 +0100 |
commit | ee34ab5b01e6e7cbd9438aeb6ccbd08d3727988e (patch) | |
tree | 74eb3f4bd68763c46f18df4c99c1789e795c5dff /drivers/gpu/drm/drm_crtc.c | |
parent | drm: Make drm_mode_attachmode() void (diff) | |
download | linux-ee34ab5b01e6e7cbd9438aeb6ccbd08d3727988e.tar.xz linux-ee34ab5b01e6e7cbd9438aeb6ccbd08d3727988e.zip |
drm: Fix memory leak in drm_mode_setcrtc()
The mode passed to the .set_config() hook was never freed. The drivers
will make a copy of the mode, so simply free it when done.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d2e09d98691a..9ccb92fdd7b2 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -643,6 +643,9 @@ EXPORT_SYMBOL(drm_mode_create); */ void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode) { + if (!mode) + return; + drm_mode_object_put(dev, &mode->base); kfree(mode); @@ -1812,6 +1815,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, } mode = drm_mode_create(dev); + if (!mode) { + ret = -ENOMEM; + goto out; + } + drm_crtc_convert_umode(mode, &crtc_req->mode); drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); } @@ -1881,6 +1889,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, out: kfree(connector_set); + drm_mode_destroy(dev, mode); mutex_unlock(&dev->mode_config.mutex); return ret; } |