Merge branch 'master' of github.com:FreeRDP/FreeRDP

This commit is contained in:
Marc-André Moreau 2014-05-29 19:27:11 -04:00
commit 6002188514
2 changed files with 23 additions and 16 deletions

View File

@ -234,7 +234,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
free(name);
pNamedPipe = (WINPR_NAMED_PIPE*) malloc(sizeof(WINPR_NAMED_PIPE));
pNamedPipe = (WINPR_NAMED_PIPE*) calloc(1, sizeof(WINPR_NAMED_PIPE));
hNamedPipe = (HANDLE) pNamedPipe;
WINPR_HANDLE_SET_TYPE(pNamedPipe, HANDLE_TYPE_NAMED_PIPE);

View File

@ -34,6 +34,8 @@
#include <unistd.h>
#endif
#include <assert.h>
#include "../handle/handle.h"
BOOL CloseHandle(HANDLE hObject)
@ -167,27 +169,32 @@ BOOL CloseHandle(HANDLE hObject)
pipe = (WINPR_NAMED_PIPE*) Object;
if (--pipe->dwRefCount == 0)
if (pipe->ServerMode)
{
pipe->pfnRemoveBaseNamedPipeFromList(pipe);
assert(pipe->dwRefCount);
if (pipe->pBaseNamedPipe)
if (--pipe->dwRefCount == 0)
{
CloseHandle((HANDLE) pipe->pBaseNamedPipe);
pipe->pfnRemoveBaseNamedPipeFromList(pipe);
if (pipe->pBaseNamedPipe)
{
CloseHandle((HANDLE) pipe->pBaseNamedPipe);
}
}
if (pipe->clientfd != -1)
close(pipe->clientfd);
if (pipe->serverfd != -1)
close(pipe->serverfd);
free((char *)pipe->lpFileName);
free((char *)pipe->lpFilePath);
free((char *)pipe->name);
free(pipe);
}
if (pipe->clientfd != -1)
close(pipe->clientfd);
if (pipe->serverfd != -1)
close(pipe->serverfd);
free((char *)pipe->lpFileName);
free((char *)pipe->lpFilePath);
free((char *)pipe->name);
free(pipe);
return TRUE;
}
else if (Type == HANDLE_TYPE_ACCESS_TOKEN)