From d0fa636643edc8677a67459aa941a57778ea40fb Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Tue, 15 Mar 2011 19:18:45 +0100 Subject: [PATCH] Properly take ownership of new device address Added addresses are transferred from dev to the existing rd. Set the address to NULL in dev to avoid free()ing it in device_free() a few lines down the road. --- src/player.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/player.c b/src/player.c index d448ea7b..bd8ec012 100644 --- a/src/player.c +++ b/src/player.c @@ -1389,6 +1389,9 @@ device_add(struct player_command *cmd) rd->v4_address = dev->v4_address; rd->v4_port = dev->v4_port; + + /* Address is ours now */ + dev->v4_address = NULL; } if (dev->v6_address) @@ -1398,6 +1401,9 @@ device_add(struct player_command *cmd) rd->v6_address = dev->v6_address; rd->v6_port = dev->v6_port; + + /* Address is ours now */ + dev->v6_address = NULL; } if (rd->name)