From: Dan Carpenter Date: Sat, 6 Mar 2010 11:05:39 +0000 (+0300) Subject: drm/i915: fix small leak on overlay error path X-Git-Tag: v2.6.33.2~60 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=211dfa81845fb609e91816791df78d60426777c0;p=karo-tx-linux.git drm/i915: fix small leak on overlay error path commit 915a428e43acfd05e4ffeaf40549b0cf163eebe2 upstream. We should free "params" before returning. Signed-off-by: Dan Carpenter Reviewed-by: Daniel Vetter Signed-off-by: Eric Anholt Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 2639591c72e9..63f569b580b5 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -1083,14 +1083,18 @@ int intel_overlay_put_image(struct drm_device *dev, void *data, drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id, DRM_MODE_OBJECT_CRTC); - if (!drmmode_obj) - return -ENOENT; + if (!drmmode_obj) { + ret = -ENOENT; + goto out_free; + } crtc = to_intel_crtc(obj_to_crtc(drmmode_obj)); new_bo = drm_gem_object_lookup(dev, file_priv, put_image_rec->bo_handle); - if (!new_bo) - return -ENOENT; + if (!new_bo) { + ret = -ENOENT; + goto out_free; + } mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->struct_mutex); @@ -1180,6 +1184,7 @@ out_unlock: mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->mode_config.mutex); drm_gem_object_unreference(new_bo); +out_free: kfree(params); return ret;