From a3035a9c9c90a399346e5ae75c35275badcc38e4 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 24 Jan 2000 05:05:43 +0000 Subject: [PATCH] break the link between the protocol object and its inner object when the client is ending its session with the server, so that the connection object and protocol object can be freed. --- lib/omapi/connection.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/omapi/connection.c b/lib/omapi/connection.c index a0b6d2c82b..47d0e8b1ba 100644 --- a/lib/omapi/connection.c +++ b/lib/omapi/connection.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: connection.c,v 1.11 2000/01/22 00:17:47 tale Exp $ */ +/* $Id: connection.c,v 1.12 2000/01/24 05:05:43 tale Exp $ */ /* Principal Author: Ted Lemon */ @@ -123,13 +123,19 @@ free_connection(omapi_connection_t *connection) { */ object_signal((omapi_object_t *)connection, "disconnect", connection); -#if 0 /* - * Free the inner generic object via the protocol object. - * XXXDCL wildass stab in the dark + * Break the link between the protocol object and its parent + * (usually a generic object); this is done so the client's + * reference to its managing object does not prevent the connection + * object and protocol object from being destroyed. */ - OBJECT_DEREF(&connection->inner->inner); -#endif + if (connection->is_client) { + INSIST(connection->inner->type == omapi_type_protocol && + connection->inner->inner != NULL); + OBJECT_DEREF(&connection->inner->inner->outer); + OBJECT_DEREF(&connection->inner->inner); + } else + INSIST(connection->inner->inner == NULL); /* * Finally, free the object itself. @@ -615,8 +621,8 @@ connect_toserver(omapi_object_t *protocol, const char *server_name, int port) { return (ISC_R_SUCCESS); free_object: - OBJECT_DEREF(&connection); OBJECT_DEREF(&protocol->outer); + OBJECT_DEREF(&connection); return (result); free_obuffer: