diff --git a/windows/agent-client.c b/windows/agent-client.c index 5109b0f0..4eb0bcfb 100644 --- a/windows/agent-client.c +++ b/windows/agent-client.c @@ -163,6 +163,7 @@ bool agent_exists(void) struct agent_pending_query { struct handle *handle; + HANDLE os_handle; strbuf *response; void (*callback)(void *, void *, int); void *callback_ctx; @@ -260,6 +261,7 @@ static agent_pending_query *named_pipe_agent_query( pq = snew(agent_pending_query); pq->handle = handle_input_new(pipehandle, named_pipe_agent_gotdata, pq, 0); + pq->os_handle = pipehandle; pipehandle = INVALID_HANDLE_VALUE; /* prevent it being closed below */ pq->response = strbuf_new_nm(); pq->callback = callback; @@ -284,6 +286,7 @@ static agent_pending_query *named_pipe_agent_query( void agent_cancel_query(agent_pending_query *pq) { handle_free(pq->handle); + CloseHandle(pq->os_handle); if (pq->response) strbuf_free(pq->response); sfree(pq);