From patchwork Thu Feb 17 20:33:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 571761 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1HKZMls030237 for ; Thu, 17 Feb 2011 20:35:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757954Ab1BQUe5 (ORCPT ); Thu, 17 Feb 2011 15:34:57 -0500 Received: from swampdragon.chaosbits.net ([90.184.90.115]:23183 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751067Ab1BQUez (ORCPT ); Thu, 17 Feb 2011 15:34:55 -0500 Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id 3846A9403D; Thu, 17 Feb 2011 21:33:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id 2FE7B9403B; Thu, 17 Feb 2011 21:33:56 +0100 (CET) Date: Thu, 17 Feb 2011 21:33:56 +0100 (CET) From: Jesper Juhl To: Matthias Schwarzott cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Dan Carpenter , Tejun Heo , Mauro Carvalho Chehab Subject: Re: [Patch] Zarlink zl10036 DVB-S: Fix mem leak in zl10036_attach In-Reply-To: <201102172054.12773.zzam@gentoo.org> Message-ID: References: <201102172054.12773.zzam@gentoo.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 17 Feb 2011 20:35:23 +0000 (UTC) diff --git a/drivers/media/dvb/frontends/zl10036.c b/drivers/media/dvb/frontends/zl10036.c index 4627f49..81aa984 100644 --- a/drivers/media/dvb/frontends/zl10036.c +++ b/drivers/media/dvb/frontends/zl10036.c @@ -463,16 +463,16 @@ struct dvb_frontend *zl10036_attach(struct dvb_frontend *fe, const struct zl10036_config *config, struct i2c_adapter *i2c) { - struct zl10036_state *state = NULL; + struct zl10036_state *state; int ret; - if (NULL == config) { + if (!config) { printk(KERN_ERR "%s: no config specified", __func__); - goto error; + return NULL; } state = kzalloc(sizeof(struct zl10036_state), GFP_KERNEL); - if (NULL == state) + if (!state) return NULL; state->config = config; @@ -507,7 +507,7 @@ struct dvb_frontend *zl10036_attach(struct dvb_frontend *fe, return fe; error: - zl10036_release(fe); + kfree(state); return NULL; } EXPORT_SYMBOL(zl10036_attach);