Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030823Ab2HHTg5 (ORCPT ); Wed, 8 Aug 2012 15:36:57 -0400 Received: from 1010ds2-suoe.0.fullrate.dk ([90.184.90.115]:14464 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030413Ab2HHTgx (ORCPT ); Wed, 8 Aug 2012 15:36:53 -0400 Date: Wed, 8 Aug 2012 21:36:51 +0200 (CEST) From: Jesper Juhl To: Sachin Kamat cc: Dmitry Torokhov , Sourav Poddar , Felipe Balbi , JJ Ding , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Abraham Arce , Syed Rafiuddin Subject: Re: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe() In-Reply-To: Message-ID: References: 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: 939 Lines: 24 On Wed, 8 Aug 2012, Sachin Kamat wrote: > On 7 August 2012 23:46, Jesper Juhl wrote: > > If omap4_keypad_parse_dt() does not return 0 (zero) in > > omap4_keypad_probe() we will leak the memory we allocated for > > 'keypad_data' with kzalloc() when we return and the variable goes out > > of scope. > > How about using devm_kzalloc() instead which will take care of freeing > the memory on detach? > Perhaps. I'm not (yet) familiar with how that function works, so I had not considered it. I'll look into it. -- Jesper Juhl http://www.chaosbits.net/ Don't top-post http://www.catb.org/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/