Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755999Ab2HGSiw (ORCPT ); Tue, 7 Aug 2012 14:38:52 -0400 Received: from 1010ds2-suoe.0.fullrate.dk ([90.184.90.115]:12392 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753255Ab2HGSiv (ORCPT ); Tue, 7 Aug 2012 14:38:51 -0400 Date: Tue, 7 Aug 2012 20:38:49 +0200 (CEST) From: Jesper Juhl To: linux-kernel@vger.kernel.org cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, "David S. Miller" , Antonio Quartulli , Simon Wunderlich , Marek Lindner Subject: Re: [PATCH] batman-adv: Fix mem leak in the batadv_tt_local_event() function 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: 1381 Lines: 41 On Tue, 7 Aug 2012, Jesper Juhl wrote: > Memory is allocated for 'tt_change_node' with kmalloc(). > 'tt_change_node' may go out of scope really being used for anything This should of course read "... go out of scope without really being used ..." . > (except have a few members initialized) if we hit the 'del:' label. > This patch makes sure we free the memory in that case. > > Signed-off-by: Jesper Juhl > --- > net/batman-adv/translation-table.c | 1 + > 1 file changed, 1 insertion(+) > > Compile tested only. > > diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c > index a438f4b..99dd8f7 100644 > --- a/net/batman-adv/translation-table.c > +++ b/net/batman-adv/translation-table.c > @@ -197,6 +197,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, > del: > list_del(&entry->list); > kfree(entry); > + kfree(tt_change_node); > event_removed = true; > goto unlock; > } > -- 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/