Re: [B.A.T.M.A.N.] [PATCH 5/6] batman-adv: Save overheard and tx packets for decoding.

Antonio Quartulli
2012-12-01T11:07:12Z

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

On Sat, Dec 01, 2012 at 12:01:50PM +0100, Antonio Quartulli wrote:
> Hi Martin,
>
> On Fri, Nov 30, 2012 at 04:08:34PM +0100, Martin Hundebøll wrote:
> > @@ -47,8 +48,9 @@ static void batadv_nc_start_timer(struct batadv_priv *bat_priv)
> > int batadv_nc_init(struct batadv_priv *bat_priv)
> > {
> > bat_priv->nc.timestamp_fwd_flush = jiffies;
> > + bat_priv->nc.timestamp_sniffed_purge = jiffies;
> >
> > - if (bat_priv->nc.coding_hash)
> > + if (bat_priv->nc.coding_hash || bat_priv->nc.decoding_hash)
> > return 0;
> >
> > bat_priv->nc.coding_hash = batadv_hash_new(128);
> > @@ -58,6 +60,13 @@ int batadv_nc_init(struct batadv_priv *bat_priv)
> > batadv_hash_set_lock_class(bat_priv->nc.coding_hash,
> > &batadv_nc_coding_hash_lock_class_key);
> >
> > + bat_priv->nc.decoding_hash = batadv_hash_new(128);
> > + if (!bat_priv->nc.decoding_hash)
> > + goto err;
>
> the label err brings the flow to a lonely "return -ENOMEM". However if you it
> the case above it means that you already allocated "bat_priv->nc.coding_hash"
> successfully. May you need another label so that you can free "coding_hash"
> and avoid memory leak?

Sorry, I'm wrong here. Returning -ENOMEM will make the caller function proceed
with the cleaning up. Therefore you can ignore this comment.

Cheers,

--
Antonio Quartulli

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

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