From: Sebastian Harl Date: Fri, 11 Apr 2014 07:13:55 +0000 (+0200) Subject: frontend: Fixed a memory leak in the connection context handler. X-Git-Tag: sysdb-0.1.0~131 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1913e0c2281b514d1f38559bd2b88dc5c92d4efc;p=sysdb.git frontend: Fixed a memory leak in the connection context handler. Previously, the ownership was not taken away from the thread-specific data aftter removing the connection from the current context, thus leaking each connection object. --- diff --git a/src/frontend/connection.c b/src/frontend/connection.c index 69c71ed..1fa4ba9 100644 --- a/src/frontend/connection.c +++ b/src/frontend/connection.c @@ -185,7 +185,13 @@ sdb_conn_ctx_init(void) static void sdb_conn_set_ctx(sdb_conn_t *conn) { + sdb_conn_t *old; + sdb_conn_ctx_init(); + + old = pthread_getspecific(conn_ctx_key); + if (old) + sdb_object_deref(SDB_OBJ(old)); if (conn) sdb_object_ref(SDB_OBJ(conn)); pthread_setspecific(conn_ctx_key, conn);