diff options
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/raw/clisocket.c | 13 | ||||
-rw-r--r-- | source4/libcli/raw/clitransport.c | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 66555695d3..0edb95e1a1 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -35,6 +35,17 @@ struct clisocket_connect { const char *dest_host; }; + +static int smbcli_sock_destructor(void *ptr) +{ + struct smbcli_socket *sock = talloc_get_type(ptr, struct smbcli_socket); + + if (sock->event.fde && sock->event.ctx) { + event_remove_fd(sock->event.ctx, sock->event.fde); + } + return 0; +} + /* create a smbcli_socket context */ @@ -53,6 +64,8 @@ struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx) return NULL; } + talloc_set_destructor(sock, smbcli_sock_destructor); + return sock; } diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 55a7e25f72..eb9d2dde78 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -54,7 +54,6 @@ static int transport_destructor(void *ptr) struct smbcli_transport *transport = ptr; smbcli_transport_dead(transport); - event_remove_fd(transport->socket->event.ctx, transport->socket->event.fde); event_remove_timed(transport->socket->event.ctx, transport->socket->event.te); return 0; } |