diff options
Diffstat (limited to 'source4/libcli/raw/clisocket.c')
-rw-r--r-- | source4/libcli/raw/clisocket.c | 13 |
1 files changed, 13 insertions, 0 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; } |