From patchwork Tue Nov 20 16:09:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 1774851 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0B608DFF38 for ; Tue, 20 Nov 2012 16:10:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753319Ab2KTQJq (ORCPT ); Tue, 20 Nov 2012 11:09:46 -0500 Received: from cantor2.suse.de ([195.135.220.15]:58633 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753002Ab2KTQJp (ORCPT ); Tue, 20 Nov 2012 11:09:45 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 8E5FD99430; Tue, 20 Nov 2012 17:09:43 +0100 (CET) Date: Tue, 20 Nov 2012 17:09:40 +0100 (CET) From: Jiri Kosina To: Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] HID: i2c-hid: fix memory leak during probe Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In case we are returning from i2c_hid_probe() through the 'err' or err_mem_free labels, there is noone freeing the buffers allocated by i2c_hid_alloc_buffers(). Signed-off-by: Jiri Kosina Reviewed-by: Benjamin Tissoires --- drivers/hid/i2c-hid/i2c-hid.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 11140bd..67ab5b7 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -892,6 +892,7 @@ err: if (ihid->irq) free_irq(ihid->irq, ihid); + i2c_hid_free_buffers(ihid); kfree(ihid); return ret; }