Skip to content

Commit

Permalink
Merge branch 'master' of github.com:FreeRDP/FreeRDP
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Aug 4, 2015
2 parents 162411d + 4fb0ad0 commit d732919
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libfreerdp/core/client.c
Expand Up @@ -720,7 +720,6 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, P
EntryPoints.pVirtualChannelClose = FreeRDP_VirtualChannelClose;
EntryPoints.pVirtualChannelWrite = FreeRDP_VirtualChannelWrite;

g_pInterface = NULL;
EntryPoints.MagicNumber = FREERDP_CHANNEL_MAGIC_NUMBER;
EntryPoints.ppInterface = &g_pInterface;
EntryPoints.pExtendedData = data;
Expand All @@ -731,6 +730,7 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, P

EnterCriticalSection(&g_channels_lock);

g_pInterface = NULL;
g_ChannelInitData.channels = channels;
status = pChannelClientData->entry((PCHANNEL_ENTRY_POINTS) &EntryPoints);

Expand Down
15 changes: 15 additions & 0 deletions winpr/libwinpr/synch/wait.c
Expand Up @@ -210,6 +210,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
if (!winpr_Handle_GetInfo(hHandle, &Type, &Object))
{
WLog_ERR(TAG, "invalid hHandle.");
SetLastError(ERROR_INVALID_HANDLE);
return WAIT_FAILED;
}

Expand All @@ -221,6 +222,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
if (process->pid != waitpid(process->pid, &(process->status), 0))
{
WLog_ERR(TAG, "waitpid failure [%d] %s", errno, strerror(errno));
SetLastError(ERROR_INTERNAL_ERROR);
return WAIT_FAILED;
}

Expand Down Expand Up @@ -255,13 +257,19 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
int status;
int fd = winpr_Handle_getFd(Object);
if (fd < 0)
{
WLog_ERR(TAG, "winpr_Handle_getFd did not return a fd!");
SetLastError(ERROR_INVALID_HANDLE);
return WAIT_FAILED;
}


status = waitOnFd(fd, Object->Mode, dwMilliseconds);

if (status < 0)
{
WLog_ERR(TAG, "waitOnFd() failure [%d] %s", errno, strerror(errno));
SetLastError(ERROR_INTERNAL_ERROR);
return WAIT_FAILED;
}

Expand All @@ -271,6 +279,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
return winpr_Handle_cleanup(Object);
}

SetLastError(ERROR_INTERNAL_ERROR);
return WAIT_FAILED;
}

Expand Down Expand Up @@ -353,6 +362,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
if (!winpr_Handle_GetInfo(lpHandles[index], &Type, &Object))
{
WLog_ERR(TAG, "invalid event file descriptor");
SetLastError(ERROR_INVALID_HANDLE);
return WAIT_FAILED;
}

Expand All @@ -361,6 +371,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
if (fd == -1)
{
WLog_ERR(TAG, "invalid file descriptor");
SetLastError(ERROR_INVALID_HANDLE);
return WAIT_FAILED;
}

Expand Down Expand Up @@ -419,6 +430,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
strerror(errno));
#endif
winpr_log_backtrace(TAG, WLOG_ERROR, 20);
SetLastError(ERROR_INTERNAL_ERROR);
return WAIT_FAILED;
}

Expand Down Expand Up @@ -450,6 +462,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
if (!winpr_Handle_GetInfo(lpHandles[idx], &Type, &Object))
{
WLog_ERR(TAG, "invalid hHandle.");
SetLastError(ERROR_INVALID_HANDLE);
return WAIT_FAILED;
}

Expand All @@ -458,6 +471,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
if (fd == -1)
{
WLog_ERR(TAG, "invalid file descriptor");
SetLastError(ERROR_INVALID_HANDLE);
return WAIT_FAILED;
}

Expand Down Expand Up @@ -500,6 +514,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
while (bWaitAll || !signal_handled);

WLog_ERR(TAG, "failed (unknown error)");
SetLastError(ERROR_INTERNAL_ERROR);
return WAIT_FAILED;
}

Expand Down
3 changes: 3 additions & 0 deletions winpr/libwinpr/utils/collections/ArrayList.c
Expand Up @@ -470,6 +470,9 @@ wArrayList *ArrayList_New(BOOL synchronized)

void ArrayList_Free(wArrayList *arrayList)
{
if (!arrayList)
return;

ArrayList_Clear(arrayList);
DeleteCriticalSection(&arrayList->lock);
free(arrayList->array);
Expand Down
3 changes: 3 additions & 0 deletions winpr/libwinpr/utils/collections/BitStream.c
Expand Up @@ -348,5 +348,8 @@ wBitStream* BitStream_New()

void BitStream_Free(wBitStream* bs)
{
if (!bs)
return;

free(bs);
}
3 changes: 3 additions & 0 deletions winpr/libwinpr/utils/collections/CountdownEvent.c
Expand Up @@ -182,6 +182,9 @@ wCountdownEvent* CountdownEvent_New(DWORD initialCount)

void CountdownEvent_Free(wCountdownEvent* countdown)
{
if (!countdown)
return;

DeleteCriticalSection(&countdown->lock);
CloseHandle(countdown->event);

Expand Down
3 changes: 3 additions & 0 deletions winpr/libwinpr/utils/collections/Dictionary.c
Expand Up @@ -128,6 +128,9 @@ wDictionary* Dictionary_New(BOOL synchronized)

void Dictionary_Free(wDictionary* dictionary)
{
if (!dictionary)
return;

free(dictionary);
}

3 changes: 3 additions & 0 deletions winpr/libwinpr/utils/collections/KeyValuePair.c
Expand Up @@ -46,5 +46,8 @@ wKeyValuePair* KeyValuePair_New(void* key, void* value)

void KeyValuePair_Free(wKeyValuePair* keyValuePair)
{
if (!keyValuePair)
return;

free(keyValuePair);
}
3 changes: 3 additions & 0 deletions winpr/libwinpr/utils/collections/MessageQueue.c
Expand Up @@ -223,6 +223,9 @@ wMessageQueue* MessageQueue_New(const wObject *callback)

void MessageQueue_Free(wMessageQueue* queue)
{
if (!queue)
return;

CloseHandle(queue->event);
DeleteCriticalSection(&queue->lock);

Expand Down

0 comments on commit d732919

Please sign in to comment.