From patchwork Sat Mar 6 11:05:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 83910 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o26ERJc6026854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 6 Mar 2010 14:27:55 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NnuxU-0003l0-1f; Sat, 06 Mar 2010 14:26:24 +0000 Received: from sfi-mx-1.v28.ch3.sourceforge.com ([172.29.28.121] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nnrph-0002BN-UZ for dri-devel@lists.sourceforge.net; Sat, 06 Mar 2010 11:06:09 +0000 Received-SPF: pass (sfi-mx-1.v28.ch3.sourceforge.com: domain of gmail.com designates 209.85.220.214 as permitted sender) client-ip=209.85.220.214; envelope-from=error27@gmail.com; helo=mail-fx0-f214.google.com; Received: from mail-fx0-f214.google.com ([209.85.220.214]) by sfi-mx-1.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1Nnrph-0002Aa-2r for dri-devel@lists.sourceforge.net; Sat, 06 Mar 2010 11:06:09 +0000 Received: by fxm6 with SMTP id 6so4628fxm.2 for ; Sat, 06 Mar 2010 03:06:02 -0800 (PST) Received: by 10.87.40.12 with SMTP id s12mr3342704fgj.38.1267873562696; Sat, 06 Mar 2010 03:06:02 -0800 (PST) Received: from bicker ([62.56.130.5]) by mx.google.com with ESMTPS id e20sm3790344fga.5.2010.03.06.03.05.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 06 Mar 2010 03:06:01 -0800 (PST) Date: Sat, 6 Mar 2010 14:05:39 +0300 From: Dan Carpenter To: David Airlie Subject: [patch] i915: fix small leak on error path Message-ID: <20100306110539.GD4958@bicker> Mail-Followup-To: Dan Carpenter , David Airlie , Eric Anholt , Daniel Vetter , maximlevitsky@gmail.com, Chris Wilson , Luca Barbieri , dri-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam-Score: 4.1 (++++) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 2.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 1.1 RCVD_IN_SORBS_WEB RBL: SORBS: sender is a abuseable web server [62.56.130.5 listed in dnsbl.sorbs.net] 1.5 RCVD_IN_PSBL RBL: Received via a relay in PSBL [62.56.130.5 listed in psbl.surriel.com] -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.0 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.8 AWL AWL: From: address is in the auto white-list X-Headers-End: 1Nnrph-0002Aa-2r X-Mailman-Approved-At: Sat, 06 Mar 2010 14:26:22 +0000 Cc: Luca Barbieri , Daniel Vetter , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.sourceforge.net X-BeenThere: dri-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 06 Mar 2010 14:27:55 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index d355d1d..60595fc 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -1068,14 +1068,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); @@ -1165,6 +1169,7 @@ out_unlock: mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->mode_config.mutex); drm_gem_object_unreference_unlocked(new_bo); +out_free: kfree(params); return ret;