From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Marek Lindner Date: Fri, 4 May 2012 15:48:50 +0800 References: <1335690403-25228-1-git-send-email-sven@narfation.org> <201205041534.18504.lindner_marek@yahoo.de> <1398273.h5rYArleKn@bentobox> In-Reply-To: <1398273.h5rYArleKn@bentobox> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201205041548.50448.lindner_marek@yahoo.de> Subject: Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Free local translation table on error in tt_init Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: The list for a Better Approach To Mobile Ad-hoc Networking On Friday, May 04, 2012 15:43:14 Sven Eckelmann wrote: > On Friday, May 04, 2012 03:34:18 PM Marek Lindner wrote: > > On Sunday, April 29, 2012 17:06:42 Sven Eckelmann wrote: > > > Signed-off-by: Sven Eckelmann > > > --- > > > > > > translation-table.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/translation-table.c b/translation-table.c > > > index 88c62f1..c3b7773 100644 > > > --- a/translation-table.c > > > +++ b/translation-table.c > > > @@ -1776,8 +1776,10 @@ int tt_init(struct bat_priv *bat_priv) > > > > > > if (!tt_local_init(bat_priv)) > > > > > > return 0; > > > > > > - if (!tt_global_init(bat_priv)) > > > + if (!tt_global_init(bat_priv)) { > > > + tt_local_table_free(bat_priv); > > > > > > return 0; > > > > > > + } > > > > > > tt_start_timer(bat_priv); > > > > Is this really necessary ? If tt_init() fails mesh_free() is called to > > free all tt buffers / lists / hashes. This is how the other *_init() > > function calls do it as well. > > Ok, forgot about that. It is just became "normal" for me to assume that the > local function is cleaning their stuff and does not "leak" in error > situations. Yes, I had the same thought at the beginning. If we change this function we also should change all other _init() functions, no ? Simply to be consistent ? Regards, Marek