summaryrefslogtreecommitdiff
path: root/source4/libcli/nbt
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/nbt')
-rw-r--r--source4/libcli/nbt/nbtsocket.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c
index 664e6fdce0..d970f8e4e0 100644
--- a/source4/libcli/nbt/nbtsocket.c
+++ b/source4/libcli/nbt/nbtsocket.c
@@ -29,16 +29,6 @@
#define NBT_MAX_REPLIES 1000
/*
- destroy a nbt socket
-*/
-static int nbtsock_destructor(void *ptr)
-{
- struct nbt_name_socket *nbtsock = talloc_get_type(ptr, struct nbt_name_socket);
- event_remove_fd(nbtsock->event_ctx, nbtsock->fde);
- return 0;
-}
-
-/*
destroy a pending request
*/
static int nbt_name_request_destructor(void *ptr)
@@ -56,7 +46,6 @@ static int nbt_name_request_destructor(void *ptr)
req->request->name_trn_id = 0;
}
if (req->te) {
- event_remove_timed(req->nbtsock->event_ctx, req->te);
req->te = NULL;
}
if (req->nbtsock->send_queue == NULL) {
@@ -279,7 +268,7 @@ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
fde.private = nbtsock;
nbtsock->fde = event_add_fd(nbtsock->event_ctx, &fde);
- talloc_set_destructor(nbtsock, nbtsock_destructor);
+ talloc_steal(nbtsock, nbtsock->fde);
return nbtsock;
@@ -356,6 +345,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
te.handler = nbt_name_socket_timeout;
te.private = req;
req->te = event_add_timed(nbtsock->event_ctx, &te);
+ talloc_steal(req, req->te);
talloc_set_destructor(req, nbt_name_request_destructor);