From 1addbfaaa594aa34daf5a38ce0038ec74e878d7c Mon Sep 17 00:00:00 2001
From: Linus Nordberg <linus@nordu.net>
Date: Mon, 14 Mar 2011 00:22:41 +0100
Subject: Don't free connection on error, just close it.

---
 lib/conn.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'lib')

diff --git a/lib/conn.c b/lib/conn.c
index f85eec6..58290f5 100644
--- a/lib/conn.c
+++ b/lib/conn.c
@@ -20,11 +20,12 @@
 int
 conn_close (struct rs_connection **connp)
 {
-  int r;
+  int r = 0;
   assert (connp);
   assert (*connp);
-  r = rs_conn_destroy (*connp);
-  if (!r)
+  if ((*connp)->is_connected)
+    r = rs_conn_disconnect (*connp);
+  if (r == RSE_OK)
     *connp = NULL;
   return r;
 }
-- 
cgit v1.1