From 97f7aa8f422a752be11ac2a0641438d75bd1f13f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 1 Sep 2015 12:27:54 +0200 Subject: [PATCH] Fixed uninitialized values. --- channels/smartcard/client/smartcard_main.c | 124 ++++++++++----------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/channels/smartcard/client/smartcard_main.c b/channels/smartcard/client/smartcard_main.c index cf20a5c27..e8aa3c556 100644 --- a/channels/smartcard/client/smartcard_main.c +++ b/channels/smartcard/client/smartcard_main.c @@ -36,8 +36,8 @@ void* smartcard_context_thread(SMARTCARD_CONTEXT* pContext) { DWORD nCount; - LONG status; - DWORD waitStatus; + LONG status = 0; + DWORD waitStatus; HANDLE hEvents[2]; wMessage message; SMARTCARD_DEVICE* smartcard; @@ -51,23 +51,23 @@ void* smartcard_context_thread(SMARTCARD_CONTEXT* pContext) while (1) { - waitStatus = WaitForMultipleObjects(nCount, hEvents, FALSE, INFINITE); + waitStatus = WaitForMultipleObjects(nCount, hEvents, FALSE, INFINITE); - if (waitStatus == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error); - break; - } + if (waitStatus == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error); + break; + } - waitStatus = WaitForSingleObject(MessageQueue_Event(pContext->IrpQueue), 0); + waitStatus = WaitForSingleObject(MessageQueue_Event(pContext->IrpQueue), 0); - if (waitStatus == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); - break; - } + if (waitStatus == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); + break; + } if (waitStatus == WAIT_OBJECT_0) { @@ -515,23 +515,23 @@ static void* smartcard_thread_func(void* arg) { status = WaitForMultipleObjects(nCount, hEvents, FALSE, INFINITE); - if (status == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error); - break; - } + if (status == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error); + break; + } - status = WaitForSingleObject(MessageQueue_Event(smartcard->IrpQueue), 0); + status = WaitForSingleObject(MessageQueue_Event(smartcard->IrpQueue), 0); - if (status == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); - break; - } + if (status == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); + break; + } - if (status == WAIT_OBJECT_0) + if (status == WAIT_OBJECT_0) { if (!MessageQueue_Peek(smartcard->IrpQueue, &message, TRUE)) { @@ -545,19 +545,19 @@ static void* smartcard_thread_func(void* arg) { while (1) { - status = WaitForSingleObject(Queue_Event(smartcard->CompletedIrpQueue), 0); + status = WaitForSingleObject(Queue_Event(smartcard->CompletedIrpQueue), 0); - if (status == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); - goto out; - } + if (status == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); + goto out; + } - if (status == WAIT_TIMEOUT) - break; + if (status == WAIT_TIMEOUT) + break; - irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue); + irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue); if (irp) { @@ -565,12 +565,12 @@ static void* smartcard_thread_func(void* arg) { status = WaitForSingleObject(irp->thread, INFINITE); - if (status == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); - goto out; - } + if (status == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); + goto out; + } CloseHandle(irp->thread); irp->thread = NULL; @@ -599,19 +599,19 @@ static void* smartcard_thread_func(void* arg) } } - status = WaitForSingleObject(Queue_Event(smartcard->CompletedIrpQueue), 0); + status = WaitForSingleObject(Queue_Event(smartcard->CompletedIrpQueue), 0); - if (status == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); - break; - } + if (status == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); + break; + } - if (status == WAIT_OBJECT_0) - { + if (status == WAIT_OBJECT_0) + { - irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue); + irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue); if (irp) { @@ -619,12 +619,12 @@ static void* smartcard_thread_func(void* arg) { status = WaitForSingleObject(irp->thread, INFINITE); - if (status == WAIT_FAILED) - { - error = GetLastError(); - WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); - break; - } + if (status == WAIT_FAILED) + { + error = GetLastError(); + WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error); + break; + } CloseHandle(irp->thread); irp->thread = NULL;