From 63f8df381c3c7d5c349fdfb1f4ea1cf6ae40d521 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 28 Nov 2015 18:37:15 +0100 Subject: [PATCH] write_redis: don't return with lock held --- src/write_redis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/write_redis.c b/src/write_redis.c index ecbea4e2..5dd674cf 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -70,10 +70,11 @@ static int wr_write (const data_set_t *ds, /* {{{ */ value_ptr = &value[0]; status = format_values (value_ptr, value_size, ds, vl, /* store rates = */ 0); - pthread_mutex_lock (&node->lock); if (status != 0) return (status); + pthread_mutex_lock (&node->lock); + if (node->conn == NULL) { node->conn = credis_connect (node->host, node->port, node->timeout); -- 2.30.2