From: Marek Lindner <lindner_marek@yahoo.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Free local translation table on error in tt_init
Date: Fri, 4 May 2012 15:48:50 +0800 [thread overview]
Message-ID: <201205041548.50448.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1398273.h5rYArleKn@bentobox>
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 <sven@narfation.org>
> > > ---
> > >
> > > 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
prev parent reply other threads:[~2012-05-04 7:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-29 9:06 [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Free local translation table on error in tt_init Sven Eckelmann
2012-04-29 9:06 ` [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Return error codes instead of -1 on failures Sven Eckelmann
2012-04-29 9:12 ` [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Free local translation table on error in tt_init Antonio Quartulli
2012-04-29 9:31 ` [B.A.T.M.A.N.] [RFC 3/2] batman-adv: Free bla hashes on error in bla_init Sven Eckelmann
2012-05-04 7:34 ` [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Free local translation table on error in tt_init Marek Lindner
2012-05-04 7:43 ` Sven Eckelmann
2012-05-04 7:48 ` Marek Lindner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201205041548.50448.lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox