Module: wine Branch: master Commit: 7092590c90624978823ff875e5ea6f2adcf73fff URL: http://source.winehq.org/git/wine.git/?a=commit;h=7092590c90624978823ff875e5...
Author: Rob Shearman rob@codeweavers.com Date: Thu Dec 6 15:08:11 2007 +0000
rpcrt4: Use an alertable wait in rpcrt4_protseq_np_wait_for_new_connection to fix a small memory leak flagged by Valgrind.
This is called only by the RPCRT4_server_thread so we don't have to worry about application user APCs being run at improper times.
---
dlls/rpcrt4/rpc_transport.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index 0c893e8..ea49b77 100644 --- a/dlls/rpcrt4/rpc_transport.c +++ b/dlls/rpcrt4/rpc_transport.c @@ -604,8 +604,16 @@ static int rpcrt4_protseq_np_wait_for_new_connection(RpcServerProtseq *protseq,
if (!objs) return -1; - - res = WaitForMultipleObjects(count, objs, FALSE, INFINITE); + + do + { + /* an alertable wait isn't strictly necessary, but due to our + * overlapped I/O implementation in Wine we need to free some memory + * by the file user APC being called, even if no completion routine was + * specified at the time of starting the async operation */ + res = WaitForMultipleObjectsEx(count, objs, FALSE, INFINITE, TRUE); + } while (res == WAIT_IO_COMPLETION); + if (res == WAIT_OBJECT_0) return 0; else if (res == WAIT_FAILED)