From db9bb83fa5ec72da38eb5bd0c259ef8c76a71858 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 3 Jul 2014 01:19:21 +0200
Subject: [PATCH] bus: close a bus that failed to connect

---
 src/libsystemd/sd-bus/sd-bus.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c
index c25375c..28fc19e 100644
--- src/libsystemd/sd-bus/sd-bus.c
+++ src/libsystemd/sd-bus/sd-bus.c
@@ -1033,8 +1033,10 @@ _public_ int sd_bus_start(sd_bus *bus) {
         else
                 return -EINVAL;
 
-        if (r < 0)
+        if (r < 0) {
+                sd_bus_close(bus);
                 return r;
+        }
 
         return bus_send_hello(bus);
 }
-- 
1.7.9.2

