public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
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.] [PATCHv2 1/2] batman-adv: Only set hash class after hash is initialized
Date: Sat, 5 May 2012 16:49:41 +0200	[thread overview]
Message-ID: <20120505144940.GB3041@ritirata.org> (raw)
In-Reply-To: <1336217249-16071-1-git-send-email-sven@narfation.org>

[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]

On Sat, May 05, 2012 at 01:27:27 +0200, Sven Eckelmann wrote:
> We must be sure that there was no error during the creation of the hash before
> we can set the hash lock class. The class set function was added to the wrong
> place in 2c9aa3b4c37bd55148f5f25212c89e7bf5f28497
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  bridge_loop_avoidance.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
> index 8bb274b..48831c2 100644
> --- a/bridge_loop_avoidance.c
> +++ b/bridge_loop_avoidance.c
> @@ -1169,13 +1169,13 @@ int bla_init(struct bat_priv *bat_priv)
>  	bat_priv->claim_hash = hash_new(128);
>  	bat_priv->backbone_hash = hash_new(32);
>  
> +	if (!bat_priv->claim_hash || !bat_priv->backbone_hash)
> +		return -1;
> +

if one hash_new succeeds and and the other fails, should we free the allocated
structure before returning?


Cheers,


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

  parent reply	other threads:[~2012-05-05 14:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04  7:32 [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: Free local translation table on error in tt_init Sven Eckelmann
2012-05-04  7:32 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: Free bla hashes on error in bla_init Sven Eckelmann
2012-05-04  7:32 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: Return error codes instead of -1 on failures Sven Eckelmann
2012-05-05 11:27 ` [B.A.T.M.A.N.] [PATCHv2 1/2] batman-adv: Only set hash class after hash is initialized Sven Eckelmann
2012-05-05 11:27   ` [B.A.T.M.A.N.] [PATCHv2 2/2] batman-adv: Return error codes instead of -1 on failures Sven Eckelmann
2012-05-06 12:36     ` Marek Lindner
2012-05-05 14:49   ` Antonio Quartulli [this message]
2012-05-05 15:04     ` [B.A.T.M.A.N.] [PATCHv2 1/2] batman-adv: Only set hash class after hash is initialized Sven Eckelmann
2012-05-05 15:16       ` Antonio Quartulli
2012-05-06 12:24   ` Marek Lindner

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=20120505144940.GB3041@ritirata.org \
    --to=ordex@autistici.org \
    --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