Commit b4cc5a21 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ole32: Error handling clean up in local_server_thread.

parent 260e1cb0
...@@ -1917,16 +1917,12 @@ static DWORD WINAPI local_server_thread(LPVOID param) ...@@ -1917,16 +1917,12 @@ static DWORD WINAPI local_server_thread(LPVOID param)
DWORD ret; DWORD ret;
ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE); ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
if (ret != WAIT_OBJECT_0) if (ret != WAIT_OBJECT_0)
{
CloseHandle(hPipe);
break; break;
}
} }
/* client already connected isn't an error */ /* client already connected isn't an error */
else if (error != ERROR_PIPE_CONNECTED) else if (error != ERROR_PIPE_CONNECTED)
{ {
ERR("ConnectNamedPipe failed with error %d\n", GetLastError()); ERR("ConnectNamedPipe failed with error %d\n", GetLastError());
CloseHandle(hPipe);
break; break;
} }
} }
...@@ -1935,20 +1931,14 @@ static DWORD WINAPI local_server_thread(LPVOID param) ...@@ -1935,20 +1931,14 @@ static DWORD WINAPI local_server_thread(LPVOID param)
hres = IStream_Stat(pStm,&ststg,STATFLAG_NONAME); hres = IStream_Stat(pStm,&ststg,STATFLAG_NONAME);
if (hres) if (hres)
{ break;
CloseHandle(hPipe);
CloseHandle(pipe_event);
return hres;
}
seekto.u.LowPart = 0; seekto.u.LowPart = 0;
seekto.u.HighPart = 0; seekto.u.HighPart = 0;
hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos); hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos);
if (hres) { if (hres) {
FIXME("IStream_Seek failed, %x\n",hres); FIXME("IStream_Seek failed, %x\n",hres);
CloseHandle(hPipe); break;
CloseHandle(pipe_event);
return hres;
} }
buflen = ststg.cbSize.u.LowPart; buflen = ststg.cbSize.u.LowPart;
...@@ -1957,10 +1947,8 @@ static DWORD WINAPI local_server_thread(LPVOID param) ...@@ -1957,10 +1947,8 @@ static DWORD WINAPI local_server_thread(LPVOID param)
hres = IStream_Read(pStm,buffer,buflen,&res); hres = IStream_Read(pStm,buffer,buflen,&res);
if (hres) { if (hres) {
FIXME("Stream Read failed, %x\n",hres); FIXME("Stream Read failed, %x\n",hres);
CloseHandle(hPipe);
CloseHandle(pipe_event);
HeapFree(GetProcessHeap(),0,buffer); HeapFree(GetProcessHeap(),0,buffer);
return hres; break;
} }
WriteFile(hPipe,buffer,buflen,&res,&ovl); WriteFile(hPipe,buffer,buflen,&res,&ovl);
...@@ -1974,22 +1962,22 @@ static DWORD WINAPI local_server_thread(LPVOID param) ...@@ -1974,22 +1962,22 @@ static DWORD WINAPI local_server_thread(LPVOID param)
if (!multi_use) if (!multi_use)
{ {
TRACE("single use object, shutting down pipe %s\n", debugstr_w(pipefn)); TRACE("single use object, shutting down pipe %s\n", debugstr_w(pipefn));
CloseHandle(hPipe);
break; break;
} }
new_pipe = CreateNamedPipeW( pipefn, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, new_pipe = CreateNamedPipeW( pipefn, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE|PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, PIPE_TYPE_BYTE|PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
4096, 4096, 500 /* 0.5 second timeout */, NULL ); 4096, 4096, 500 /* 0.5 second timeout */, NULL );
CloseHandle(hPipe);
if (new_pipe == INVALID_HANDLE_VALUE) if (new_pipe == INVALID_HANDLE_VALUE)
{ {
FIXME("pipe creation failed for %s, le is %u\n", debugstr_w(pipefn), GetLastError()); FIXME("pipe creation failed for %s, le is %u\n", debugstr_w(pipefn), GetLastError());
CloseHandle(pipe_event); break;
return 1;
} }
CloseHandle(hPipe);
hPipe = new_pipe; hPipe = new_pipe;
} }
CloseHandle(pipe_event); CloseHandle(pipe_event);
CloseHandle(hPipe);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment