From patchwork Thu Aug 18 13:43:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 1076622 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7IDjvTd032528 for ; Thu, 18 Aug 2011 13:45:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755329Ab1HRNp4 (ORCPT ); Thu, 18 Aug 2011 09:45:56 -0400 Received: from mail-gx0-f174.google.com ([209.85.161.174]:35869 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755204Ab1HRNp4 (ORCPT ); Thu, 18 Aug 2011 09:45:56 -0400 Received: by gxk21 with SMTP id 21so1471200gxk.19 for ; Thu, 18 Aug 2011 06:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=MDOuAXM5eJq122uEwPLp+qBPNGhODP3jKvm6kUwQkg4=; b=fT3opq5ZGVLrfFmGiUVJAAGjvHesQJl89sF2HLRpatbCkXwBuQihQdSbQjoRVKGsoG JL/ZfjJscsIQNsbJ4gDzzkrL+uHCHcBfMFQL0cX1cXWvBbzV9Bpf5128ZqBo0VBKUtHb MnsORT4pKAXzANbPpQt5aKURkupaYZMiB4a3s= Received: by 10.142.224.3 with SMTP id w3mr404371wfg.360.1313675155203; Thu, 18 Aug 2011 06:45:55 -0700 (PDT) Received: from shale.localdomain ([41.139.221.94]) by mx.google.com with ESMTPS id i8sm1484959pbi.92.2011.08.18.06.45.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 06:45:54 -0700 (PDT) Date: Thu, 18 Aug 2011 16:43:43 +0300 From: Dan Carpenter To: Jiri Kosina Cc: "open list:HID CORE LAYER" , kernel-janitors@vger.kernel.org Subject: [patch 2/2 -next] hid-lg4ff: add a kfree() to an error path Message-ID: <20110818134343.GB21927@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 18 Aug 2011 13:45:57 +0000 (UTC) There is a small rare potential memory leak here. But it's easy to fix. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index dc38c2d..2b4bbcb 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c @@ -438,6 +438,7 @@ int lg4ff_init(struct hid_device *hid) entry->device_id = (char *)kzalloc(strlen((&hid->dev)->kobj.name) + 1, GFP_KERNEL); if (!entry->device_id) { hid_err(hid, "Cannot set device_id, insufficient memory.\n"); + kfree(entry); return -ENOMEM; } strcpy(entry->device_id, (&hid->dev)->kobj.name);