Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753012Ab0L3XUk (ORCPT ); Thu, 30 Dec 2010 18:20:40 -0500 Received: from swampdragon.chaosbits.net ([90.184.90.115]:27791 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254Ab0L3XUj (ORCPT ); Thu, 30 Dec 2010 18:20:39 -0500 Date: Fri, 31 Dec 2010 00:11:30 +0100 (CET) From: Jesper Juhl To: linux-media@vger.kernel.org cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Malcolm Priestley Subject: [PATVH] media, dvb, IX2505V: Remember to free allocated memory in failure path (ix2505v_attach()). Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1183 Lines: 39 Hi, We may leak the storage allocated to 'state' in drivers/media/dvb/frontends/ix2505v.c::ix2505v_attach() on error. This patch makes sure we free the allocated memory in the failure case. Signed-off-by: Jesper Juhl --- ix2505v.c | 1 + 1 file changed, 1 insertion(+) Compile tested only. diff --git a/drivers/media/dvb/frontends/ix2505v.c b/drivers/media/dvb/frontends/ix2505v.c index 55f2eba..fcb173d 100644 --- a/drivers/media/dvb/frontends/ix2505v.c +++ b/drivers/media/dvb/frontends/ix2505v.c @@ -293,6 +293,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe, ret = ix2505v_read_status_reg(state); if (ret & 0x80) { + kfree(state); deb_i2c("%s: No IX2505V found\n", __func__); goto error; } -- Jesper Juhl http://www.chaosbits.net/ Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/