r2655: fixed an error in the shutdown of the sock->transport->session->tree
authorAndrew Tridgell <tridge@samba.org>
Sun, 26 Sep 2004 07:04:35 +0000 (07:04 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:17 +0000 (12:59 -0500)
smbcli raw context handling

source/libcli/raw/clisession.c
source/libcli/raw/clisocket.c
source/libcli/raw/clitransport.c
source/libcli/raw/clitree.c

index 75b964501870a50b946562821b37f8fa4052dc91..516da2fa2e0a4789b39519a54c7e57eea2c0fdef 100644 (file)
@@ -55,7 +55,6 @@ void smbcli_session_close(struct smbcli_session *session)
        session->reference_count--;
        if (session->reference_count <= 0) {
                smbcli_transport_close(session->transport);
-               talloc_free(session);
        }
 }
 
index 566367233379fbb7953867718e64c08b2ef96e75..8481bc73e2e00cf833c79be9cbb9ff86faefc6f1 100644 (file)
@@ -104,6 +104,7 @@ void smbcli_sock_close(struct smbcli_socket *sock)
        sock->reference_count--;
        if (sock->reference_count <= 0) {
                smbcli_sock_dead(sock);
+               talloc_free(sock);
        }
 }
 
index c0d84179d6c15a20d7cd92effc8677e5ecc13036..d70ceceab3aba2ff3d2d00997a5d085a1a267654 100644 (file)
@@ -90,11 +90,10 @@ void smbcli_transport_close(struct smbcli_transport *transport)
 {
        transport->reference_count--;
        if (transport->reference_count <= 0) {
-               smbcli_sock_close(transport->socket);
                event_remove_fd(transport->event.ctx, transport->event.fde);
                event_remove_timed(transport->event.ctx, transport->event.te);
                event_context_destroy(transport->event.ctx);
-               talloc_free(transport);
+               smbcli_sock_close(transport->socket);
        }
 }
 
index c383eef768a084daa3cd2f9791ad4299bb0b4b98..e3a1a6d34195ae696b8315ed4016423e3255fc88 100644 (file)
@@ -55,7 +55,6 @@ void smbcli_tree_close(struct smbcli_tree *tree)
        tree->reference_count--;
        if (tree->reference_count <= 0) {
                smbcli_session_close(tree->session);
-               talloc_free(tree);
        }
 }
 
@@ -193,6 +192,8 @@ NTSTATUS smbcli_tree_full_connection(struct smbcli_tree **ret_tree,
                return NT_STATUS_NO_MEMORY;
        }
 
+       talloc_set_name_const(sock, "smbcli_tree_full_connection");
+
        /* open a TCP socket to the server */
        if (!smbcli_sock_connect_byname(sock, dest_host, port)) {
                DEBUG(2,("Failed to establish socket connection - %s\n", strerror(errno)));