diff --git a/src/connection.c b/src/connection.c index c76a2e9d..9b155f3c 100644 --- a/src/connection.c +++ b/src/connection.c @@ -748,6 +748,7 @@ static void _handle_source_request (client_t *client, char *uri, int auth_style) source->con = client->con; if (connection_complete_source (source, 1) < 0) { + source_clear_source (source); source_free_source (source); } else diff --git a/src/slave.c b/src/slave.c index 6932835f..1d4a5870 100644 --- a/src/slave.c +++ b/src/slave.c @@ -238,13 +238,16 @@ static void *start_relay_stream (void *arg) src->parser = parser; src->con = con; + global_lock (); if (client_create (&src->client, con, parser) < 0) { + global_unlock (); /* make sure only the client_destory frees these */ con = NULL; parser = NULL; break; } + global_unlock (); con = NULL; parser = NULL; client_set_queue (src->client, NULL);