From b4cc5a2114592a5e336ba353688f04db6da0bdfb Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 13 May 2013 12:31:31 +0200 Subject: [PATCH] ole32: Error handling clean up in local_server_thread. --- dlls/ole32/rpc.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c index 5070117f006..625938074a7 100644 --- a/dlls/ole32/rpc.c +++ b/dlls/ole32/rpc.c @@ -1917,16 +1917,12 @@ static DWORD WINAPI local_server_thread(LPVOID param) DWORD ret; ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE); if (ret != WAIT_OBJECT_0) - { - CloseHandle(hPipe); break; - } } /* client already connected isn't an error */ else if (error != ERROR_PIPE_CONNECTED) { ERR("ConnectNamedPipe failed with error %d\n", GetLastError()); - CloseHandle(hPipe); break; } } @@ -1935,20 +1931,14 @@ static DWORD WINAPI local_server_thread(LPVOID param) hres = IStream_Stat(pStm,&ststg,STATFLAG_NONAME); if (hres) - { - CloseHandle(hPipe); - CloseHandle(pipe_event); - return hres; - } + break; seekto.u.LowPart = 0; seekto.u.HighPart = 0; hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos); if (hres) { FIXME("IStream_Seek failed, %x\n",hres); - CloseHandle(hPipe); - CloseHandle(pipe_event); - return hres; + break; } buflen = ststg.cbSize.u.LowPart; @@ -1957,10 +1947,8 @@ static DWORD WINAPI local_server_thread(LPVOID param) hres = IStream_Read(pStm,buffer,buflen,&res); if (hres) { FIXME("Stream Read failed, %x\n",hres); - CloseHandle(hPipe); - CloseHandle(pipe_event); HeapFree(GetProcessHeap(),0,buffer); - return hres; + break; } WriteFile(hPipe,buffer,buflen,&res,&ovl); @@ -1974,22 +1962,22 @@ static DWORD WINAPI local_server_thread(LPVOID param) if (!multi_use) { TRACE("single use object, shutting down pipe %s\n", debugstr_w(pipefn)); - CloseHandle(hPipe); break; } new_pipe = CreateNamedPipeW( pipefn, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE|PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 4096, 4096, 500 /* 0.5 second timeout */, NULL ); - CloseHandle(hPipe); if (new_pipe == INVALID_HANDLE_VALUE) { FIXME("pipe creation failed for %s, le is %u\n", debugstr_w(pipefn), GetLastError()); - CloseHandle(pipe_event); - return 1; + break; } + CloseHandle(hPipe); hPipe = new_pipe; } + CloseHandle(pipe_event); + CloseHandle(hPipe); return 0; }