[commits] batman-adv; branch, master, updated. v2010.1.0-174-g16506a6

postmaster at open-mesh.org postmaster at open-mesh.org
Sat Sep 18 17:36:12 CEST 2010

The following commit has been merged in the master branch:
commit beb5157f3eb704480451bdd2e5d65ad1f71e987a
Author: Sven Eckelmann <sven.eckelmann at gmx.de>
Date:   Sat Sep 18 15:35:45 2010 +0000

    batman-adv: Track references of batman_if in set_primary_if
    set_primary_if exchanges the current primary interfaces with a new one.
    This is a new reference and thus we have to count it and decrease the
    count of the old primary interface.
    Signed-off-by: Sven Eckelmann <sven.eckelmann at gmx.de>

diff --git a/hard-interface.c b/hard-interface.c
index f519b4b..942a44a 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -113,9 +113,17 @@ static void set_primary_if(struct bat_priv *bat_priv,
 	struct batman_packet *batman_packet;
 	struct vis_packet *vis_packet;
+	struct batman_if *old_if;
+	if (batman_if)
+		hardif_hold(batman_if);
+	old_if = bat_priv->primary_if;
 	bat_priv->primary_if = batman_if;
+	if (old_if)
+		hardif_put(old_if);
 	if (!bat_priv->primary_if)


More information about the commits mailing list