From 7201bb06faac7d7573399406f8bbfe1401111414 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Ritschard Date: Wed, 13 Apr 2016 22:17:57 +0200 Subject: [PATCH] write_riemann: avoid deadlock on connection failures --- src/write_riemann.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/write_riemann.c b/src/write_riemann.c index 2b68e883..63e89186 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -135,8 +135,10 @@ static int wrr_send(struct riemann_host *host, riemann_message_t *msg) /* {{{ */ pthread_mutex_lock (&host->lock); status = wrr_connect(host); - if (status != 0) + if (status != 0) { + pthread_mutex_unlock(&host->lock); return status; + } status = riemann_client_send_message(host->client, msg); if (status != 0) { -- 2.11.0