From: Sebastian Harl Date: Fri, 11 Apr 2014 07:18:28 +0000 (+0200) Subject: frontend: Force-close the connection in sdb_connection_close(). X-Git-Tag: sysdb-0.1.0~129 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e2f1ad2dd762373e0fa6c4b2c732d9fb094ee45c;p=sysdb.git frontend: Force-close the connection in sdb_connection_close(). Previously, it would still be kept open if someone else referenced the object. --- 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 */