Commit 7cad0b70 authored by Karl Heyes's avatar Karl Heyes

do proper cleanup on odd cases of source client startup, also take mutex

lock for client_create at relay startup to prevent race

svn path=/icecast/trunk/icecast/; revision=10004
parent 32691f49
...@@ -748,6 +748,7 @@ static void _handle_source_request (client_t *client, char *uri, int auth_style) ...@@ -748,6 +748,7 @@ static void _handle_source_request (client_t *client, char *uri, int auth_style)
source->con = client->con; source->con = client->con;
if (connection_complete_source (source, 1) < 0) if (connection_complete_source (source, 1) < 0)
{ {
source_clear_source (source);
source_free_source (source); source_free_source (source);
} }
else else
......
...@@ -238,13 +238,16 @@ static void *start_relay_stream (void *arg) ...@@ -238,13 +238,16 @@ static void *start_relay_stream (void *arg)
src->parser = parser; src->parser = parser;
src->con = con; src->con = con;
global_lock ();
if (client_create (&src->client, con, parser) < 0) if (client_create (&src->client, con, parser) < 0)
{ {
global_unlock ();
/* make sure only the client_destory frees these */ /* make sure only the client_destory frees these */
con = NULL; con = NULL;
parser = NULL; parser = NULL;
break; break;
} }
global_unlock ();
con = NULL; con = NULL;
parser = NULL; parser = NULL;
client_set_queue (src->client, NULL); client_set_queue (src->client, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment