From 23cdc7e529c616e6a26adbd8875e36ad992ea683 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 29 Oct 2015 02:34:02 +0100 Subject: [PATCH] server: Unconditionally close APC handle in get_apc_result call. Signed-off-by: Sebastian Lackner Signed-off-by: Alexandre Julliard --- dlls/ntdll/server.c | 1 - server/thread.c | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index f6457db3514..356d6319f15 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -677,7 +677,6 @@ unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call, a SERVER_END_REQ; if (!ret && result->type == APC_NONE) continue; /* APC didn't run, try again */ - if (ret) NtClose( handle ); } return ret; } diff --git a/server/thread.c b/server/thread.c index 63830002736..d65ea8998c7 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1602,13 +1602,12 @@ DECL_HANDLER(get_apc_result) if (!(apc = (struct thread_apc *)get_handle_obj( current->process, req->handle, 0, &thread_apc_ops ))) return; - if (!apc->executed) set_error( STATUS_PENDING ); - else - { - reply->result = apc->result; - /* close the handle directly to avoid an extra round-trip */ - close_handle( current->process, req->handle ); - } + + if (apc->executed) reply->result = apc->result; + else set_error( STATUS_PENDING ); + + /* close the handle directly to avoid an extra round-trip */ + close_handle( current->process, req->handle ); release_object( apc ); }