From f1a26f036b1fd1aa8f31dfbe2d857b0bb31abaa1 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 13 Aug 2007 19:59:52 +0000 Subject: Handle unix client disconnect properly before we have received a configuration message --- audio/unix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'audio/unix.c') diff --git a/audio/unix.c b/audio/unix.c index d977633c..52b27809 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -162,7 +162,8 @@ static gboolean client_cb(GIOChannel *chan, GIOCondition cond, gpointer data) if (cond & (G_IO_HUP | G_IO_ERR)) { debug("Unix client disconnected"); - device_set_state(client->dev, STATE_CONNECTED); + if (client->dev) + device_set_state(client->dev, STATE_CONNECTED); goto failed; } @@ -232,7 +233,7 @@ static gboolean server_cb(GIOChannel *chan, GIOCondition cond, gpointer data) debug("Accepted new client connection on unix socket"); - client = g_new(struct unix_client, 1); + client = g_new0(struct unix_client, 1); client->sock = cli_sk; clients = g_slist_append(clients, client); -- cgit