[1/3] batman-adv: Remove vis info on hashing errors

Message ID 1296236047-15200-1-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sven Eckelmann Jan. 28, 2011, 5:34 p.m. UTC
  A newly created vis info object must be removed when it couldn't be
added to the hash. The old_info which has to be replaced was already
removed and isn't related to the hash anymore.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 batman-adv/vis.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
  

Comments

Simon Wunderlich Jan. 29, 2011, 5:44 p.m. UTC | #1
Hello Sven,

i've applied your patches in r1922-r1924.

Thanks for your contribution
	Simon

On Fri, Jan 28, 2011 at 06:34:05PM +0100, Sven Eckelmann wrote:
> A newly created vis info object must be removed when it couldn't be
> added to the hash. The old_info which has to be replaced was already
> removed and isn't related to the hash anymore.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  batman-adv/vis.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/batman-adv/vis.c b/batman-adv/vis.c
> index 2cdf01c..9d2729c 100644
> --- a/batman-adv/vis.c
> +++ b/batman-adv/vis.c
> @@ -446,7 +446,7 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
>  			      info);
>  	if (hash_added < 0) {
>  		/* did not work (for some reason) */
> -		kref_put(&old_info->refcount, free_info);
> +		kref_put(&info->refcount, free_info);
>  		info = NULL;
>  	}
>  
> -- 
> 1.7.2.3
> 
>
  

Patch

diff --git a/batman-adv/vis.c b/batman-adv/vis.c
index 2cdf01c..9d2729c 100644
--- a/batman-adv/vis.c
+++ b/batman-adv/vis.c
@@ -446,7 +446,7 @@  static struct vis_info *add_packet(struct bat_priv *bat_priv,
 			      info);
 	if (hash_added < 0) {
 		/* did not work (for some reason) */
-		kref_put(&old_info->refcount, free_info);
+		kref_put(&info->refcount, free_info);
 		info = NULL;
 	}