From e2f1ad2dd762373e0fa6c4b2c732d9fb094ee45c Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 11 Apr 2014 09:18:28 +0200 Subject: [PATCH] frontend: Force-close the connection in sdb_connection_close(). Previously, it would still be kept open if someone else referenced the object. --- src/frontend/connection.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/frontend/connection.c b/src/frontend/connection.c index b98987d..93829ab 100644 --- a/src/frontend/connection.c +++ b/src/frontend/connection.c @@ -439,6 +439,14 @@ sdb_connection_accept(int fd) void sdb_connection_close(sdb_conn_t *conn) { + if (! conn) + return; + + /* close the connection even if someone else still references it */ + if (conn->fd >= 0) + close(conn->fd); + conn->fd = -1; + sdb_object_deref(SDB_OBJ(conn)); } /* sdb_connection_close */ -- 2.30.2