[return checks] fix use of CloseHandle

This commit is contained in:
akallabeth 2024-09-16 04:58:36 +02:00
parent cd18dea174
commit 965d231e49
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
113 changed files with 288 additions and 290 deletions

View File

@ -327,7 +327,7 @@ static UINT ainput_server_open(ainput_server_context* context)
if (!ainput->thread)
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(ainput->stopEvent);
(void)CloseHandle(ainput->stopEvent);
ainput->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -360,8 +360,8 @@ static UINT ainput_server_close(ainput_server_context* context)
return error;
}
CloseHandle(ainput->thread);
CloseHandle(ainput->stopEvent);
(void)CloseHandle(ainput->thread);
(void)CloseHandle(ainput->stopEvent);
ainput->thread = NULL;
ainput->stopEvent = NULL;
}

View File

@ -302,7 +302,7 @@ static UINT audin_alsa_open(IAudinDevice* device, AudinReceive receive, void* us
return CHANNEL_RC_OK;
error_out:
CloseHandle(alsa->stopEvent);
(void)CloseHandle(alsa->stopEvent);
alsa->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -332,9 +332,9 @@ static UINT audin_alsa_close(IAudinDevice* device)
return error;
}
CloseHandle(alsa->stopEvent);
(void)CloseHandle(alsa->stopEvent);
alsa->stopEvent = NULL;
CloseHandle(alsa->thread);
(void)CloseHandle(alsa->thread);
alsa->thread = NULL;
}

View File

@ -309,7 +309,7 @@ static UINT audin_oss_open(IAudinDevice* device, AudinReceive receive, void* use
if (!(oss->thread = CreateThread(NULL, 0, audin_oss_thread_func, oss, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(oss->stopEvent);
(void)CloseHandle(oss->stopEvent);
oss->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -341,9 +341,9 @@ static UINT audin_oss_close(IAudinDevice* device)
return error;
}
CloseHandle(oss->stopEvent);
(void)CloseHandle(oss->stopEvent);
oss->stopEvent = NULL;
CloseHandle(oss->thread);
(void)CloseHandle(oss->thread);
oss->thread = NULL;
}

View File

@ -204,7 +204,7 @@ static UINT audin_sndio_open(IAudinDevice* device, AudinReceive receive, void* u
sndio, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed");
CloseHandle(sndio->stopEvent);
(void)CloseHandle(sndio->stopEvent);
sndio->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -236,9 +236,9 @@ static UINT audin_sndio_close(IAudinDevice* device)
return error;
}
CloseHandle(sndio->stopEvent);
(void)CloseHandle(sndio->stopEvent);
sndio->stopEvent = NULL;
CloseHandle(sndio->thread);
(void)CloseHandle(sndio->thread);
sndio->thread = NULL;
}

View File

@ -304,8 +304,8 @@ static UINT audin_winmm_close(IAudinDevice* device)
return error;
}
CloseHandle(winmm->thread);
CloseHandle(winmm->stopEvent);
(void)CloseHandle(winmm->thread);
(void)CloseHandle(winmm->stopEvent);
winmm->thread = NULL;
winmm->stopEvent = NULL;
winmm->receive = NULL;
@ -436,7 +436,7 @@ static UINT audin_winmm_open(IAudinDevice* device, AudinReceive receive, void* u
if (!(winmm->thread = CreateThread(NULL, 0, audin_winmm_thread_func, winmm, 0, NULL)))
{
WLog_Print(winmm->log, WLOG_ERROR, "CreateThread failed!");
CloseHandle(winmm->stopEvent);
(void)CloseHandle(winmm->stopEvent);
winmm->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}

View File

@ -489,7 +489,7 @@ static BOOL audin_server_open(audin_server_context* context)
CreateThread(NULL, 0, audin_server_thread_func, (void*)audin, 0, NULL)))
{
WLog_Print(audin->log, WLOG_ERROR, "CreateThread failed!");
CloseHandle(audin->stopEvent);
(void)CloseHandle(audin->stopEvent);
audin->stopEvent = NULL;
return FALSE;
}
@ -525,8 +525,8 @@ static BOOL audin_server_close(audin_server_context* context)
return FALSE;
}
CloseHandle(audin->thread);
CloseHandle(audin->stopEvent);
(void)CloseHandle(audin->thread);
(void)CloseHandle(audin->stopEvent);
audin->thread = NULL;
audin->stopEvent = NULL;
}

View File

@ -594,7 +594,7 @@ static void channel_client_handler_free(msg_proc_internals* internals)
return;
if (internals->thread)
CloseHandle(internals->thread);
(void)CloseHandle(internals->thread);
MessageQueue_Free(internals->queue);
Stream_Free(internals->data_in, TRUE);
free(internals->channel_name);

View File

@ -1395,7 +1395,7 @@ static UINT cliprdr_server_start(CliprdrServerContext* context)
if (!(cliprdr->Thread = CreateThread(NULL, 0, cliprdr_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(cliprdr->StopEvent);
(void)CloseHandle(cliprdr->StopEvent);
cliprdr->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -1429,8 +1429,8 @@ static UINT cliprdr_server_stop(CliprdrServerContext* context)
return error;
}
CloseHandle(cliprdr->Thread);
CloseHandle(cliprdr->StopEvent);
(void)CloseHandle(cliprdr->Thread);
(void)CloseHandle(cliprdr->StopEvent);
}
if (cliprdr->ChannelHandle)

View File

@ -465,7 +465,7 @@ static UINT disp_server_open(DispServerContext* context)
CreateThread(NULL, 0, disp_server_thread_func, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->stopEvent);
priv->stopEvent = NULL;
rc = ERROR_INTERNAL_ERROR;
goto out_close;
@ -559,8 +559,8 @@ static UINT disp_server_close(DispServerContext* context)
return error;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -1770,7 +1770,7 @@ static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc)
return status;
}
CloseHandle(drdynvc->thread);
(void)CloseHandle(drdynvc->thread);
drdynvc->thread = NULL;
}
else

View File

@ -138,7 +138,7 @@ static UINT drdynvc_server_start(DrdynvcServerContext* context)
CreateThread(NULL, 0, drdynvc_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -163,7 +163,7 @@ static UINT drdynvc_server_stop(DrdynvcServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->Thread);
return CHANNEL_RC_OK;
}

View File

@ -361,7 +361,7 @@ BOOL drive_file_free(DRIVE_FILE* file)
if (file->file_handle != INVALID_HANDLE_VALUE)
{
CloseHandle(file->file_handle);
(void)CloseHandle(file->file_handle);
file->file_handle = INVALID_HANDLE_VALUE;
}
@ -585,7 +585,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w
if (hFile != INVALID_HANDLE_VALUE)
{
status = GetFileInformationByHandle(hFile, &fileInformation);
CloseHandle(hFile);
(void)CloseHandle(hFile);
if (!status)
goto out_fail;
@ -790,7 +790,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
if (file->file_handle != INVALID_HANDLE_VALUE)
{
CloseHandle(file->file_handle);
(void)CloseHandle(file->file_handle);
file->file_handle = INVALID_HANDLE_VALUE;
}

View File

@ -822,7 +822,7 @@ static UINT drive_free_int(DRIVE_DEVICE* drive)
if (!drive)
return ERROR_INVALID_PARAMETER;
CloseHandle(drive->thread);
(void)CloseHandle(drive->thread);
ListDictionary_Free(drive->files);
MessageQueue_Free(drive->IrpQueue);
Stream_Free(drive->device.data, TRUE);

View File

@ -307,7 +307,7 @@ static UINT echo_server_open(echo_server_context* context)
if (!(echo->thread = CreateThread(NULL, 0, echo_server_thread_func, (void*)echo, 0, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(echo->stopEvent);
(void)CloseHandle(echo->stopEvent);
echo->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -337,8 +337,8 @@ static UINT echo_server_close(echo_server_context* context)
return error;
}
CloseHandle(echo->thread);
CloseHandle(echo->stopEvent);
(void)CloseHandle(echo->thread);
(void)CloseHandle(echo->stopEvent);
echo->thread = NULL;
echo->stopEvent = NULL;
}

View File

@ -1137,7 +1137,7 @@ static UINT encomsp_virtual_channel_event_disconnected(encomspPlugin* encomsp)
}
MessageQueue_Free(encomsp->queue);
CloseHandle(encomsp->thread);
(void)CloseHandle(encomsp->thread);
encomsp->queue = NULL;
encomsp->thread = NULL;

View File

@ -311,7 +311,7 @@ static UINT encomsp_server_start(EncomspServerContext* context)
CreateThread(NULL, 0, encomsp_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -336,8 +336,8 @@ static UINT encomsp_server_stop(EncomspServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->StopEvent);
return error;
}

View File

@ -679,7 +679,7 @@ static UINT gfxredir_server_open(GfxRedirServerContext* context)
CreateThread(NULL, 0, gfxredir_server_thread_func, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->stopEvent);
priv->stopEvent = NULL;
rc = ERROR_INTERNAL_ERROR;
}
@ -714,8 +714,8 @@ static UINT gfxredir_server_close(GfxRedirServerContext* context)
return error;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -456,7 +456,7 @@ static UINT location_server_open(LocationServerContext* context)
if (!location->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(location->stopEvent);
(void)CloseHandle(location->stopEvent);
location->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -484,8 +484,8 @@ static UINT location_server_close(LocationServerContext* context)
return error;
}
CloseHandle(location->thread);
CloseHandle(location->stopEvent);
(void)CloseHandle(location->thread);
(void)CloseHandle(location->stopEvent);
location->thread = NULL;
location->stopEvent = NULL;
}

View File

@ -395,7 +395,7 @@ static UINT parallel_free_int(PARALLEL_DEVICE* parallel)
"WaitForSingleObject failed with error %" PRIu32 "!", error);
}
CloseHandle(parallel->thread);
(void)CloseHandle(parallel->thread);
Stream_Free(parallel->device.data, TRUE);
MessageQueue_Free(parallel->queue);
}

View File

@ -139,7 +139,7 @@ static BOOL printer_write_setting(const char* path, prn_conf_t type, const void*
rc = TRUE;
fail:
CloseHandle(file);
(void)CloseHandle(file);
free(base64);
return rc;
}
@ -194,7 +194,7 @@ static BOOL printer_read_setting(const char* path, prn_conf_t type, void** data,
}
fail:
CloseHandle(file);
(void)CloseHandle(file);
if (rc && (lowSize <= INT_MAX))
{
@ -929,9 +929,9 @@ static UINT printer_free(DEVICE* device)
irp->Discard(irp);
}
CloseHandle(printer_dev->thread);
CloseHandle(printer_dev->stopEvent);
CloseHandle(printer_dev->event);
(void)CloseHandle(printer_dev->thread);
(void)CloseHandle(printer_dev->stopEvent);
(void)CloseHandle(printer_dev->event);
winpr_aligned_free(printer_dev->pIrpList);
}

View File

@ -1459,7 +1459,7 @@ static UINT rail_server_start(RailServerContext* context)
return CHANNEL_RC_OK;
out_stop_event:
CloseHandle(context->priv->stopEvent);
(void)CloseHandle(context->priv->stopEvent);
context->priv->stopEvent = NULL;
out_close:
(void)WTSVirtualChannelClose(context->priv->rail_channel);
@ -1481,8 +1481,8 @@ static BOOL rail_server_stop(RailServerContext* context)
return FALSE;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -103,9 +103,9 @@ static int init_external_addin(Plugin* plugin)
}
plugin->hProcess = procInfo.hProcess;
CloseHandle(procInfo.hThread);
CloseHandle(siStartInfo.hStdOutput);
CloseHandle(siStartInfo.hStdInput);
(void)CloseHandle(procInfo.hThread);
(void)CloseHandle(siStartInfo.hStdOutput);
(void)CloseHandle(siStartInfo.hStdInput);
return 0;
}
@ -263,12 +263,12 @@ static void channel_terminated(Plugin* plugin)
if (plugin->copyThread)
(void)TerminateThread(plugin->copyThread, 0);
if (plugin->writeComplete)
CloseHandle(plugin->writeComplete);
(void)CloseHandle(plugin->writeComplete);
CloseHandle(plugin->hStdInputWrite);
CloseHandle(plugin->hStdOutputRead);
(void)CloseHandle(plugin->hStdInputWrite);
(void)CloseHandle(plugin->hStdOutputRead);
TerminateProcess(plugin->hProcess, 0);
CloseHandle(plugin->hProcess);
(void)CloseHandle(plugin->hProcess);
free(plugin->commandline);
free(plugin);
}

View File

@ -706,7 +706,7 @@ static DWORD WINAPI drive_hotplug_thread_func(LPVOID arg)
out:
if (rdpdr->stopEvent)
{
CloseHandle(rdpdr->stopEvent);
(void)CloseHandle(rdpdr->stopEvent);
rdpdr->stopEvent = NULL;
}
ExitThread(CHANNEL_RC_OK);
@ -1083,7 +1083,7 @@ out:
if (rdpdr->stopEvent)
{
CloseHandle(rdpdr->stopEvent);
(void)CloseHandle(rdpdr->stopEvent);
rdpdr->stopEvent = NULL;
}
@ -1123,7 +1123,7 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
return error;
}
CloseHandle(rdpdr->hotplugThread);
(void)CloseHandle(rdpdr->hotplugThread);
rdpdr->hotplugThread = NULL;
}
@ -2193,7 +2193,7 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
}
if (rdpdr->thread)
CloseHandle(rdpdr->thread);
(void)CloseHandle(rdpdr->thread);
MessageQueue_Free(rdpdr->queue);
rdpdr->queue = NULL;
rdpdr->thread = NULL;

View File

@ -2147,7 +2147,7 @@ static UINT rdpdr_server_start(RdpdrServerContext* context)
CreateThread(NULL, 0, rdpdr_server_thread, (void*)context, 0, NULL)))
{
WLog_Print(context->priv->log, WLOG_ERROR, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -2178,9 +2178,9 @@ static UINT rdpdr_server_stop(RdpdrServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->Thread);
context->priv->Thread = NULL;
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
}

View File

@ -531,7 +531,7 @@ UINT cam_v4l_stream_stop(CamV4lStream* stream)
if (stream->captureThread)
{
WaitForSingleObject(stream->captureThread, INFINITE);
CloseHandle(stream->captureThread);
(void)CloseHandle(stream->captureThread);
stream->captureThread = NULL;
}

View File

@ -449,7 +449,7 @@ static UINT enumerator_server_open(CamDevEnumServerContext* context)
if (!enumerator->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(enumerator->stopEvent);
(void)CloseHandle(enumerator->stopEvent);
enumerator->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -477,8 +477,8 @@ static UINT enumerator_server_close(CamDevEnumServerContext* context)
return error;
}
CloseHandle(enumerator->thread);
CloseHandle(enumerator->stopEvent);
(void)CloseHandle(enumerator->thread);
(void)CloseHandle(enumerator->stopEvent);
enumerator->thread = NULL;
enumerator->stopEvent = NULL;
}

View File

@ -601,7 +601,7 @@ static UINT device_server_open(CameraDeviceServerContext* context)
if (!device->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(device->stopEvent);
(void)CloseHandle(device->stopEvent);
device->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -629,8 +629,8 @@ static UINT device_server_close(CameraDeviceServerContext* context)
return error;
}
CloseHandle(device->thread);
CloseHandle(device->stopEvent);
(void)CloseHandle(device->thread);
(void)CloseHandle(device->stopEvent);
device->thread = NULL;
device->stopEvent = NULL;
}

View File

@ -1447,11 +1447,11 @@ static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base)
if (rdpei->thread)
{
WaitForSingleObject(rdpei->thread, INFINITE);
CloseHandle(rdpei->thread);
(void)CloseHandle(rdpei->thread);
}
if (rdpei->event)
CloseHandle(rdpei->event);
(void)CloseHandle(rdpei->event);
DeleteCriticalSection(&rdpei->lock);
free(rdpei->context);

View File

@ -406,7 +406,7 @@ static UINT mouse_cursor_server_open(MouseCursorServerContext* context)
if (!mouse_cursor->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(mouse_cursor->stopEvent);
(void)CloseHandle(mouse_cursor->stopEvent);
mouse_cursor->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -434,8 +434,8 @@ static UINT mouse_cursor_server_close(MouseCursorServerContext* context)
return error;
}
CloseHandle(mouse_cursor->thread);
CloseHandle(mouse_cursor->stopEvent);
(void)CloseHandle(mouse_cursor->thread);
(void)CloseHandle(mouse_cursor->stopEvent);
mouse_cursor->thread = NULL;
mouse_cursor->stopEvent = NULL;
}

View File

@ -1638,8 +1638,8 @@ BOOL rdpgfx_server_close(RdpgfxServerContext* context)
return FALSE;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -1462,7 +1462,7 @@ void rdpsnd_virtual_channel_event_terminated(rdpsndPlugin* rdpsnd)
if (rdpsnd->thread)
{
WaitForSingleObject(rdpsnd->thread, INFINITE);
CloseHandle(rdpsnd->thread);
(void)CloseHandle(rdpsnd->thread);
}
MessageQueue_Free(rdpsnd->queue);

View File

@ -181,7 +181,7 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device)
if (winmm->hThread)
{
WaitForSingleObject(winmm->hThread, INFINITE);
CloseHandle(winmm->hThread);
(void)CloseHandle(winmm->hThread);
winmm->hThread = NULL;
}
}

View File

@ -957,7 +957,7 @@ static UINT rdpsnd_server_start(RdpsndServerContext* context)
return CHANNEL_RC_OK;
out_stopEvent:
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
out_lock:
DeleteCriticalSection(&context->priv->lock);
@ -998,8 +998,8 @@ static UINT rdpsnd_server_stop(RdpsndServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->StopEvent);
context->priv->Thread = NULL;
context->priv->StopEvent = NULL;
}

View File

@ -970,7 +970,7 @@ static UINT remdesk_virtual_channel_event_disconnected(remdeskPlugin* remdesk)
remdesk->OpenHandle = 0;
}
MessageQueue_Free(remdesk->queue);
CloseHandle(remdesk->thread);
(void)CloseHandle(remdesk->thread);
Stream_Free(remdesk->data_in, TRUE);
remdesk->data_in = NULL;
remdesk->queue = NULL;

View File

@ -669,7 +669,7 @@ static UINT remdesk_server_start(RemdeskServerContext* context)
CreateThread(NULL, 0, remdesk_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -694,8 +694,8 @@ static UINT remdesk_server_stop(RemdeskServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->StopEvent);
return CHANNEL_RC_OK;
}

View File

@ -685,7 +685,7 @@ static void create_irp_thread(SERIAL_DEVICE* serial, IRP* irp)
return;
error_handle:
if (irpThread)
CloseHandle(irpThread);
(void)CloseHandle(irpThread);
irp->IoStatus = STATUS_NO_MEMORY;
irp->Complete(irp);
free(data);
@ -785,11 +785,11 @@ static UINT serial_free(DEVICE* device)
WLog_Print(serial->log, WLOG_ERROR,
"WaitForSingleObject failed with error %" PRIu32 "!", error);
}
CloseHandle(serial->MainThread);
(void)CloseHandle(serial->MainThread);
}
if (serial->hComm)
CloseHandle(serial->hComm);
(void)CloseHandle(*serial->hComm);
/* Clean up resources */
Stream_Free(serial->device.data, TRUE);
@ -827,7 +827,7 @@ static void irp_thread_close(void* arg)
{
(void)TerminateThread(hdl, 0);
WaitForSingleObject(hdl, INFINITE);
CloseHandle(hdl);
(void)CloseHandle(hdl);
}
}
}

View File

@ -232,7 +232,7 @@ void smartcard_context_free(void* pCtx)
if (WaitForSingleObject(pContext->thread, INFINITE) == WAIT_FAILED)
WLog_ERR(TAG, "WaitForSingleObject failed with error %" PRIu32 "!", GetLastError());
CloseHandle(pContext->thread);
(void)CloseHandle(pContext->thread);
}
MessageQueue_Free(pContext->IrpQueue);
}
@ -253,7 +253,7 @@ static UINT smartcard_free_(SMARTCARD_DEVICE* smartcard)
if (smartcard->IrpQueue)
{
MessageQueue_Free(smartcard->IrpQueue);
CloseHandle(smartcard->thread);
(void)CloseHandle(smartcard->thread);
}
Stream_Free(smartcard->device.data, TRUE);

View File

@ -233,7 +233,7 @@ static UINT sshagent_on_close(IWTSVirtualChannelCallback* pChannelCallback)
return error;
}
CloseHandle(callback->thread);
(void)CloseHandle(callback->thread);
LeaveCriticalSection(&callback->lock);
DeleteCriticalSection(&callback->lock);
free(callback);

View File

@ -325,7 +325,7 @@ static UINT telemetry_server_open(TelemetryServerContext* context)
if (!telemetry->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(telemetry->stopEvent);
(void)CloseHandle(telemetry->stopEvent);
telemetry->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -353,8 +353,8 @@ static UINT telemetry_server_close(TelemetryServerContext* context)
return error;
}
CloseHandle(telemetry->thread);
CloseHandle(telemetry->stopEvent);
(void)CloseHandle(telemetry->thread);
(void)CloseHandle(telemetry->stopEvent);
telemetry->thread = NULL;
telemetry->stopEvent = NULL;
}

View File

@ -1277,9 +1277,9 @@ error_play_thread:
error_sample_ack_list:
Queue_Free(stream->sample_list);
error_sample_list:
CloseHandle(stream->ready);
(void)CloseHandle(stream->ready);
error_ready:
CloseHandle(stream->stopEvent);
(void)CloseHandle(stream->stopEvent);
error_stopEvent:
free(stream);
return NULL;
@ -1412,7 +1412,7 @@ void s_tsmf_stream_free(void* obj)
return;
}
CloseHandle(stream->play_thread);
(void)CloseHandle(stream->play_thread);
stream->play_thread = NULL;
}
@ -1424,7 +1424,7 @@ void s_tsmf_stream_free(void* obj)
return;
}
CloseHandle(stream->ack_thread);
(void)CloseHandle(stream->ack_thread);
stream->ack_thread = NULL;
}
@ -1437,8 +1437,8 @@ void s_tsmf_stream_free(void* obj)
stream->decoder = NULL;
}
CloseHandle(stream->stopEvent);
CloseHandle(stream->ready);
(void)CloseHandle(stream->stopEvent);
(void)CloseHandle(stream->ready);
ZeroMemory(stream, sizeof(TSMF_STREAM));
free(stream);
}

View File

@ -470,13 +470,13 @@ static void udevman_free(IUDEVMAN* idevman)
if (udevman->thread)
{
WaitForSingleObject(udevman->thread, INFINITE);
CloseHandle(udevman->thread);
(void)CloseHandle(udevman->thread);
}
udevman_unregister_all_udevices(idevman);
if (udevman->devman_loading)
CloseHandle(udevman->devman_loading);
(void)CloseHandle(udevman->devman_loading);
libusb_exit(udevman->context);

View File

@ -475,7 +475,7 @@ BOOL android_cliprdr_init(androidContext* afc, CliprdrClientContext* cliprdr)
if (!(clipboard = ClipboardCreate()))
{
CloseHandle(hevent);
(void)CloseHandle(hevent);
return FALSE;
}
@ -504,6 +504,6 @@ BOOL android_cliprdr_uninit(androidContext* afc, CliprdrClientContext* cliprdr)
cliprdr->custom = NULL;
afc->cliprdr = NULL;
ClipboardDestroy(afc->clipboard);
CloseHandle(afc->clipboardRequestEvent);
(void)CloseHandle(afc->clipboardRequestEvent);
return TRUE;
}

View File

@ -325,7 +325,7 @@ BOOL android_event_queue_init(freerdp* inst)
if (!queue->events)
{
WLog_ERR(TAG, "android_event_queue_init: memory allocation failed");
CloseHandle(queue->isSet);
(void)CloseHandle(queue->isSet);
free(queue);
return FALSE;
}
@ -349,7 +349,7 @@ void android_event_queue_uninit(freerdp* inst)
{
if (queue->isSet)
{
CloseHandle(queue->isSet);
(void)CloseHandle(queue->isSet);
queue->isSet = NULL;
}

View File

@ -428,5 +428,5 @@ void mac_cliprdr_uninit(mfContext *mfc, CliprdrClientContext *cliprdr)
mfc->cliprdr = NULL;
ClipboardDestroy(mfc->clipboard);
CloseHandle(mfc->clipboardRequestEvent);
(void)CloseHandle(mfc->clipboardRequestEvent);
}

View File

@ -111,7 +111,7 @@ static void mfreerdp_client_free(freerdp *instance, rdpContext *context)
return;
mfc = (mfContext *)instance->context;
CloseHandle(mfc->stopEvent);
(void)CloseHandle(mfc->stopEvent);
}
static void mf_scale_mouse_coordinates(mfContext *mfc, UINT16 *px, UINT16 *py)

View File

@ -260,7 +260,7 @@ WinPREvent::WinPREvent(bool initial)
WinPREvent::~WinPREvent()
{
CloseHandle(_handle);
(void)CloseHandle(_handle);
}
void WinPREvent::set()

View File

@ -101,7 +101,7 @@ sdlClip::~sdlClip()
{
cliprdr_file_context_free(_file);
ClipboardDestroy(_system);
CloseHandle(_event);
(void)CloseHandle(_event);
}
BOOL sdlClip::init(CliprdrClientContext* clip)

View File

@ -306,7 +306,7 @@ WinPREvent::WinPREvent(bool initial)
WinPREvent::~WinPREvent()
{
CloseHandle(_handle);
(void)CloseHandle(_handle);
}
void WinPREvent::set()

View File

@ -575,7 +575,7 @@ static int wlfreerdp_run(freerdp* instance)
disconnect:
if (timer)
CloseHandle(timer);
(void)CloseHandle(timer);
freerdp_disconnect(instance);
return status;
}
@ -619,7 +619,7 @@ static void wlf_client_free(freerdp* instance, rdpContext* context)
UwacCloseDisplay(&wlf->display);
if (wlf->displayHandle)
CloseHandle(wlf->displayHandle);
(void)CloseHandle(wlf->displayHandle);
ArrayList_Free(wlf->events);
DeleteCriticalSection(&wlf->critical);
}

View File

@ -1467,7 +1467,7 @@ static int wfreerdp_client_stop(rdpContext* context)
{
PostThreadMessage(wfc->keyboardThreadId, WM_QUIT, 0, 0);
WaitForSingleObject(wfc->keyboardThread, INFINITE);
CloseHandle(wfc->keyboardThread);
(void)CloseHandle(wfc->keyboardThread);
wfc->keyboardThread = NULL;
wfc->keyboardThreadId = 0;
}

View File

@ -1672,7 +1672,7 @@ static FILEDESCRIPTORW* wf_cliprdr_get_file_descriptor(WCHAR* file_name, size_t
fd->nFileSizeLow = GetFileSize(hFile, &fd->nFileSizeHigh);
wcscpy_s(fd->cFileName, sizeof(fd->cFileName) / 2, file_name + pathLen);
CloseHandle(hFile);
(void)CloseHandle(hFile);
return fd;
}
@ -2536,14 +2536,14 @@ BOOL wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr)
if (clipboard->thread)
{
WaitForSingleObject(clipboard->thread, INFINITE);
CloseHandle(clipboard->thread);
(void)CloseHandle(clipboard->thread);
}
if (clipboard->response_data_event)
CloseHandle(clipboard->response_data_event);
(void)CloseHandle(clipboard->response_data_event);
if (clipboard->req_fevent)
CloseHandle(clipboard->req_fevent);
(void)CloseHandle(clipboard->req_fevent);
clear_file_array(clipboard);
clear_format_map(clipboard);

View File

@ -1452,7 +1452,7 @@ static void xf_post_disconnect(freerdp* instance)
if (xfc->pipethread)
{
WaitForSingleObject(xfc->pipethread, INFINITE);
CloseHandle(xfc->pipethread);
(void)CloseHandle(xfc->pipethread);
xfc->pipethread = NULL;
}
if (xfc->clipboard)
@ -1681,7 +1681,7 @@ static DWORD WINAPI xf_client_thread(LPVOID param)
disconnect:
if (timer)
CloseHandle(timer);
(void)CloseHandle(timer);
freerdp_disconnect(instance);
end:
@ -1832,13 +1832,13 @@ void xf_teardown_x11(xfContext* xfc)
if (xfc->x11event)
{
CloseHandle(xfc->x11event);
(void)CloseHandle(xfc->x11event);
xfc->x11event = NULL;
}
if (xfc->mutex)
{
CloseHandle(xfc->mutex);
(void)CloseHandle(xfc->mutex);
xfc->mutex = NULL;
}

View File

@ -1340,7 +1340,7 @@ int freerdp_client_common_stop(rdpContext* context)
if (cctx->thread)
{
WaitForSingleObject(cctx->thread, INFINITE);
CloseHandle(cctx->thread);
(void)CloseHandle(cctx->thread);
cctx->thread = NULL;
}

View File

@ -2079,12 +2079,12 @@ void cliprdr_file_context_free(CliprdrFileContext* file)
WLog_Print(file->log, WLOG_DEBUG, "Waiting on FUSE thread");
WaitForSingleObject(file->fuse_thread, INFINITE);
CloseHandle(file->fuse_thread);
(void)CloseHandle(file->fuse_thread);
}
if (file->fuse_stop_sync)
CloseHandle(file->fuse_stop_sync);
(void)CloseHandle(file->fuse_stop_sync);
if (file->fuse_start_sync)
CloseHandle(file->fuse_start_sync);
(void)CloseHandle(file->fuse_start_sync);
HashTable_Free(file->request_table);
HashTable_Free(file->clip_data_table);
@ -2198,7 +2198,7 @@ static BOOL is_directory(const char* path)
BY_HANDLE_FILE_INFORMATION fileInformation = { 0 };
const BOOL status = GetFileInformationByHandle(hFile, &fileInformation);
CloseHandle(hFile);
(void)CloseHandle(hFile);
if (!status)
return FALSE;

View File

@ -465,7 +465,7 @@ BOOL ios_cliprdr_init(mfContext *afc, CliprdrClientContext *cliprdr)
if (!(clipboard = ClipboardCreate()))
{
CloseHandle(hevent);
(void)CloseHandle(hevent);
return FALSE;
}
@ -494,6 +494,6 @@ BOOL ios_cliprdr_uninit(mfContext *afc, CliprdrClientContext *cliprdr)
cliprdr->custom = NULL;
afc->cliprdr = NULL;
ClipboardDestroy(afc->clipboard);
CloseHandle(afc->clipboardRequestEvent);
(void)CloseHandle(afc->clipboardRequestEvent);
return TRUE;
}

View File

@ -170,5 +170,5 @@ void ios_events_free_pipe(mfInfo *mfi)
mfi->event_pipe_consumer = mfi->event_pipe_producer = -1;
close(producer_fd);
close(consumer_fd);
CloseHandle(mfi->handle);
(void)CloseHandle(mfi->handle);
}

View File

@ -348,13 +348,13 @@ static void BIO_NAMED_free(WINPR_BIO_NAMED* ptr)
if (ptr->hFile)
{
CloseHandle(ptr->hFile);
(void)CloseHandle(ptr->hFile);
ptr->hFile = NULL;
}
if (ptr->readEvent)
{
CloseHandle(ptr->readEvent);
(void)CloseHandle(ptr->readEvent);
ptr->readEvent = NULL;
}
@ -530,7 +530,7 @@ BIO* createChildSessionBio(void)
BIO* lowLevelBio = BIO_new(BIO_s_namedpipe());
if (!lowLevelBio)
{
CloseHandle(f);
(void)CloseHandle(f);
return NULL;
}

View File

@ -895,7 +895,7 @@ void freerdp_context_free(freerdp* instance)
ctx->metrics = NULL;
if (ctx->channelErrorEvent)
CloseHandle(ctx->channelErrorEvent);
(void)CloseHandle(ctx->channelErrorEvent);
ctx->channelErrorEvent = NULL;
free(ctx->errorDescription);

View File

@ -1214,7 +1214,7 @@ void rpc_client_free(RpcClient* client)
Stream_Free(client->ReceiveFragment, TRUE);
if (client->PipeEvent)
CloseHandle(client->PipeEvent);
(void)CloseHandle(client->PipeEvent);
ringbuffer_destroy(&(client->ReceivePipe));
DeleteCriticalSection(&(client->PipeLock));

View File

@ -342,7 +342,7 @@ static void freerdp_listener_close(freerdp_listener* instance)
for (int i = 0; i < listener->num_sockfds; i++)
{
closesocket((SOCKET)listener->sockfds[i]);
CloseHandle(listener->events[i]);
(void)CloseHandle(listener->events[i]);
}
listener->num_sockfds = 0;

View File

@ -2907,7 +2907,7 @@ void update_message_proxy_free(rdpUpdateProxy* message)
if (MessageQueue_PostQuit(up->queue, 0))
WaitForSingleObject(message->thread, INFINITE);
CloseHandle(message->thread);
(void)CloseHandle(message->thread);
free(message);
}
}

View File

@ -1340,7 +1340,7 @@ void freerdp_peer_context_free(freerdp_peer* client)
{
rdpContext* ctx = client->context;
CloseHandle(ctx->channelErrorEvent);
(void)CloseHandle(ctx->channelErrorEvent);
ctx->channelErrorEvent = NULL;
free(ctx->errorDescription);
ctx->errorDescription = NULL;

View File

@ -2512,7 +2512,7 @@ void rdp_free(rdpRdp* rdp)
free(rdp->io);
PubSub_Free(rdp->pubSub);
if (rdp->abortEvent)
CloseHandle(rdp->abortEvent);
(void)CloseHandle(rdp->abortEvent);
aad_free(rdp->aad);
free(rdp);
}

View File

@ -389,7 +389,7 @@ static int transport_bio_simple_uninit(BIO* bio)
if (ptr && ptr->hEvent)
{
CloseHandle(ptr->hEvent);
(void)CloseHandle(ptr->hEvent);
ptr->hEvent = NULL;
}
@ -874,7 +874,7 @@ static BOOL freerdp_tcp_connect_timeout(rdpContext* context, int sockfd, struct
rc = TRUE;
fail:
CloseHandle(handles[0]);
(void)CloseHandle(handles[0]);
return rc;
}
@ -1422,7 +1422,7 @@ static BOOL freerdp_tcp_layer_close(void* userContext)
if (tcpLayer->sockfd >= 0)
closesocket(tcpLayer->sockfd);
if (tcpLayer->hEvent)
CloseHandle(tcpLayer->hEvent);
(void)CloseHandle(tcpLayer->hEvent);
return TRUE;
}

View File

@ -143,7 +143,7 @@ static int testAbort(int port)
if (!thread)
{
CloseHandle(s_sync);
(void)CloseHandle(s_sync);
s_sync = NULL;
return -1;
}
@ -156,8 +156,8 @@ static int testAbort(int port)
if (!freerdp_shall_disconnect_context(instance->context))
{
CloseHandle(s_sync);
CloseHandle(thread);
(void)CloseHandle(s_sync);
(void)CloseHandle(thread);
s_sync = NULL;
return -1;
}
@ -165,8 +165,8 @@ static int testAbort(int port)
status = WaitForSingleObject(thread, 20000);
end = GetTickCount();
CloseHandle(s_sync);
CloseHandle(thread);
(void)CloseHandle(s_sync);
(void)CloseHandle(thread);
s_sync = NULL;
diff = end - start;
@ -227,8 +227,8 @@ static BOOL prepare_certificates(const char* path)
goto fail;
rc = TRUE;
fail:
CloseHandle(process.hProcess);
CloseHandle(process.hThread);
(void)CloseHandle(process.hProcess);
(void)CloseHandle(process.hThread);
return rc;
}
@ -294,8 +294,8 @@ static int testSuccess(int port)
goto fail;
WaitForSingleObject(process.hProcess, INFINITE);
CloseHandle(process.hProcess);
CloseHandle(process.hThread);
(void)CloseHandle(process.hProcess);
(void)CloseHandle(process.hThread);
printf("%s: returned %d!\n", __func__, r);
rc = r;

View File

@ -1702,9 +1702,9 @@ void transport_free(rdpTransport* transport)
nla_free(transport->nla);
StreamPool_Free(transport->ReceivePool);
CloseHandle(transport->connectedEvent);
CloseHandle(transport->rereadEvent);
CloseHandle(transport->ioEvent);
(void)CloseHandle(transport->connectedEvent);
(void)CloseHandle(transport->rereadEvent);
(void)CloseHandle(transport->ioEvent);
DeleteCriticalSection(&(transport->ReadLock));
DeleteCriticalSection(&(transport->WriteLock));
free(transport);

View File

@ -1959,7 +1959,7 @@ void smartcard_call_context_free(scard_call_context* ctx)
ctx->pWinSCardApi = NULL;
HashTable_Free(ctx->rgSCardContextList);
CloseHandle(ctx->stopEvent);
(void)CloseHandle(ctx->stopEvent);
free(ctx);
}

View File

@ -84,7 +84,7 @@ static void test_peer_context_free(freerdp_peer* client, rdpContext* ctx)
WINPR_ASSERT(context->stopEvent);
(void)SetEvent(context->stopEvent);
WaitForSingleObject(context->debug_channel_thread, INFINITE);
CloseHandle(context->debug_channel_thread);
(void)CloseHandle(context->debug_channel_thread);
}
Stream_Free(context->s, TRUE);
@ -761,7 +761,7 @@ static BOOL tf_peer_post_connect(freerdp_peer* client)
CreateThread(NULL, 0, tf_debug_channel_thread_func, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "Failed to create debug channel thread");
CloseHandle(context->stopEvent);
(void)CloseHandle(context->stopEvent);
context->stopEvent = NULL;
return FALSE;
}
@ -1275,7 +1275,7 @@ static BOOL test_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
if (!(hThread = CreateThread(NULL, 0, test_peer_mainloop, (void*)client, 0, NULL)))
return FALSE;
CloseHandle(hThread);
(void)CloseHandle(hThread);
return TRUE;
}

View File

@ -82,7 +82,7 @@ int wf_directsound_activate(RdpsndServerContext* context)
WLog_ERR(TAG, "Failed to create direct sound thread");
return 1;
}
CloseHandle(hThread);
(void)CloseHandle(hThread);
return 0;
}

View File

@ -120,7 +120,7 @@ wfInfo* wf_info_init()
if (!wfi->updateSemaphore)
{
WLog_ERR(TAG, "CreateSemaphore error: %lu", GetLastError());
CloseHandle(wfi->mutex);
(void)CloseHandle(wfi->mutex);
free(wfi);
return NULL;
}
@ -130,8 +130,8 @@ wfInfo* wf_info_init()
if (!wfi->updateThread)
{
WLog_ERR(TAG, "Failed to create update thread");
CloseHandle(wfi->mutex);
CloseHandle(wfi->updateSemaphore);
(void)CloseHandle(wfi->mutex);
(void)CloseHandle(wfi->updateSemaphore);
free(wfi);
return NULL;
}
@ -142,9 +142,9 @@ wfInfo* wf_info_init()
if (!wfi->peers)
{
WLog_ERR(TAG, "Failed to allocate memory for peer");
CloseHandle(wfi->mutex);
CloseHandle(wfi->updateSemaphore);
CloseHandle(wfi->updateThread);
(void)CloseHandle(wfi->mutex);
(void)CloseHandle(wfi->updateSemaphore);
(void)CloseHandle(wfi->updateThread);
free(wfi);
return NULL;
}
@ -244,7 +244,7 @@ BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
wfreerdp_server_peer_callback_event(peerId, FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_CONNECT);
return TRUE;
fail_driver_init:
CloseHandle(context->updateEvent);
(void)CloseHandle(context->updateEvent);
context->updateEvent = NULL;
fail_update_event:
fail_peer_count:
@ -261,7 +261,7 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
peerId = ((rdpContext*)context)->peer->pId;
wfi->peers[peerId] = NULL;
wfi->peerCount--;
CloseHandle(context->updateEvent);
(void)CloseHandle(context->updateEvent);
WLog_INFO(TAG, "Unregistering Peer: id=%d, #=%d", peerId, wfi->peerCount);
#ifdef WITH_DXGI_1_2

View File

@ -182,7 +182,7 @@ BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
if (!(hThread = CreateThread(NULL, 0, wf_peer_main_loop, client, 0, NULL)))
return FALSE;
CloseHandle(hThread);
(void)CloseHandle(hThread);
return TRUE;
}
@ -399,10 +399,10 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
wf_update_peer_deactivate(wfi, context);
client->Disconnect(client);
fail_socket_thread:
CloseHandle(context->socketSemaphore);
(void)CloseHandle(context->socketSemaphore);
context->socketSemaphore = NULL;
fail_socket_semaphore:
CloseHandle(context->socketEvent);
(void)CloseHandle(context->socketEvent);
context->socketEvent = NULL;
fail_socket_event:
fail_socked_closed:

View File

@ -58,7 +58,7 @@ int wf_wasapi_activate(RdpsndServerContext* context)
WLog_ERR(TAG, "CreateThread failed");
return 1;
}
CloseHandle(hThread);
(void)CloseHandle(hThread);
return 0;
}

View File

@ -198,7 +198,7 @@ void client_to_proxy_context_free(freerdp_peer* client, rdpContext* ctx)
if (context->dynvcReady)
{
CloseHandle(context->dynvcReady);
(void)CloseHandle(context->dynvcReady);
context->dynvcReady = NULL;
}
@ -388,13 +388,13 @@ void proxy_data_free(proxyData* pdata)
return;
if (pdata->abort_event)
CloseHandle(pdata->abort_event);
(void)CloseHandle(pdata->abort_event);
if (pdata->client_thread)
CloseHandle(pdata->client_thread);
(void)CloseHandle(pdata->client_thread);
if (pdata->gfx_server_ready)
CloseHandle(pdata->gfx_server_ready);
(void)CloseHandle(pdata->gfx_server_ready);
if (pdata->modules_info)
HashTable_Free(pdata->modules_info);

View File

@ -762,7 +762,7 @@ static BOOL pf_server_start_peer(freerdp_peer* client)
args->thread = hThread;
if (!ArrayList_Append(server->peer_list, hThread))
{
CloseHandle(hThread);
(void)CloseHandle(hThread);
return FALSE;
}
@ -911,7 +911,7 @@ static BOOL are_all_required_modules_loaded(proxyModule* module, const proxyConf
static void peer_free(void* obj)
{
HANDLE hdl = (HANDLE)obj;
CloseHandle(hdl);
(void)CloseHandle(hdl);
}
proxyServer* pf_server_new(const proxyConfig* config)
@ -1063,7 +1063,7 @@ void pf_server_free(proxyServer* server)
freerdp_listener_free(server->listener);
if (server->stopEvent)
CloseHandle(server->stopEvent);
(void)CloseHandle(server->stopEvent);
pf_server_config_free(server->config);
pf_modules_free(server->module);

View File

@ -408,9 +408,9 @@ int win_shadow_rdp_init(winShadowSubsystem* subsystem)
subsystem->shw->subsystem = subsystem;
return 1;
fail_context:
CloseHandle(subsystem->RdpUpdateLeaveEvent);
(void)CloseHandle(subsystem->RdpUpdateLeaveEvent);
fail_leave_event:
CloseHandle(subsystem->RdpUpdateEnterEvent);
(void)CloseHandle(subsystem->RdpUpdateEnterEvent);
fail_enter_event:
return -1;
}

View File

@ -1420,7 +1420,7 @@ static int x11_shadow_subsystem_uninit(rdpShadowSubsystem* sub)
if (subsystem->common.event)
{
CloseHandle(subsystem->common.event);
(void)CloseHandle(subsystem->common.event);
subsystem->common.event = NULL;
}
@ -1462,7 +1462,7 @@ static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub)
if (MessageQueue_PostQuit(subsystem->common.MsgPipe->In, 0))
WaitForSingleObject(subsystem->thread, INFINITE);
CloseHandle(subsystem->thread);
(void)CloseHandle(subsystem->thread);
subsystem->thread = NULL;
}

View File

@ -2586,7 +2586,7 @@ BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
else
{
/* Close the thread handle to make it detached. */
CloseHandle(client->thread);
(void)CloseHandle(client->thread);
client->thread = NULL;
}

View File

@ -79,11 +79,11 @@ rdpShadowMultiClientEvent* shadow_multiclient_new(void)
out_free_subscribers:
ArrayList_Free(event->subscribers);
out_free_doneEvent:
CloseHandle(event->doneEvent);
(void)CloseHandle(event->doneEvent);
out_free_barrierEvent:
CloseHandle(event->barrierEvent);
(void)CloseHandle(event->barrierEvent);
out_free_event:
CloseHandle(event->event);
(void)CloseHandle(event->event);
out_free:
free(event);
out_error:
@ -98,9 +98,9 @@ void shadow_multiclient_free(rdpShadowMultiClientEvent* event)
DeleteCriticalSection(&(event->lock));
ArrayList_Free(event->subscribers);
CloseHandle(event->doneEvent);
CloseHandle(event->barrierEvent);
CloseHandle(event->event);
(void)CloseHandle(event->doneEvent);
(void)CloseHandle(event->barrierEvent);
(void)CloseHandle(event->event);
free(event);
}

View File

@ -744,7 +744,7 @@ int shadow_server_stop(rdpShadowServer* server)
{
(void)SetEvent(server->StopEvent);
WaitForSingleObject(server->thread, INFINITE);
CloseHandle(server->thread);
(void)CloseHandle(server->thread);
server->thread = NULL;
if (server->listener && server->listener->Close)
server->listener->Close(server->listener);
@ -978,7 +978,7 @@ int shadow_server_uninit(rdpShadowServer* server)
free(server->ConfigPath);
server->ConfigPath = NULL;
DeleteCriticalSection(&(server->lock));
CloseHandle(server->StopEvent);
(void)CloseHandle(server->StopEvent);
server->StopEvent = NULL;
ArrayList_Free(server->clients);
server->clients = NULL;

View File

@ -1106,7 +1106,7 @@ static UINT file_get_range(struct synthetic_file* file, UINT64 offset, UINT32 si
if (!GetFileInformationByHandle(file->fd, &FileInfo))
{
CloseHandle(file->fd);
(void)CloseHandle(file->fd);
file->fd = INVALID_HANDLE_VALUE;
error = GetLastError();
WLog_ERR(TAG, "Get file [%s] information fail: 0x%08" PRIx32, file->local_name, error);

View File

@ -1356,8 +1356,7 @@ HANDLE CommCreateFileA(LPCSTR lpDeviceName, DWORD dwDesiredAccess, DWORD dwShare
return (HANDLE)pComm;
error_handle:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
CloseHandle(pComm);
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC(void) CloseHandle(pComm);
WINPR_PRAGMA_DIAG_POP
return INVALID_HANDLE_VALUE;
}

View File

@ -144,7 +144,7 @@ int TestCommConfig(int argc, char* argv[])
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
}
CloseHandle(hComm);
(void)CloseHandle(hComm);
return 0;
}

View File

@ -64,7 +64,7 @@ int TestCommMonitor(int argc, char* argv[])
}
}
CloseHandle(hComm);
(void)CloseHandle(hComm);
return 0;
}

View File

@ -118,10 +118,10 @@ int TestErrorSetLastError(int argc, char* argv[])
WaitForSingleObject(threads[2], INFINITE);
WaitForSingleObject(threads[3], INFINITE);
CloseHandle(threads[0]);
CloseHandle(threads[1]);
CloseHandle(threads[2]);
CloseHandle(threads[3]);
(void)CloseHandle(threads[0]);
(void)CloseHandle(threads[1]);
(void)CloseHandle(threads[2]);
(void)CloseHandle(threads[3]);
error = GetLastError();

View File

@ -26,7 +26,7 @@ static BOOL create_layout_files(size_t level, const char* BasePath, wArrayList*
if (hdl == INVALID_HANDLE_VALUE)
return FALSE;
ArrayList_Append(files, FilePath);
CloseHandle(hdl);
(void)CloseHandle(hdl);
}
return TRUE;
}
@ -228,7 +228,7 @@ static int TestFileFindFirstFileA(const char* str)
CreateFileA(FilePath, GENERIC_ALL, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hdl == INVALID_HANDLE_VALUE)
goto fail;
CloseHandle(hdl);
(void)CloseHandle(hdl);
if (!find_first_file_success(FilePath))
goto fail;

View File

@ -43,7 +43,7 @@ int TestFileGetStdHandle(int argc, char* argv[])
(void)fprintf(stderr, "write failed\n");
return -1;
}
CloseHandle(so);
(void)CloseHandle(so);
return 0;
}

View File

@ -57,7 +57,7 @@ static BOOL test_SetFileAttributesA(void)
FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
goto fail;
CloseHandle(handle);
(void)CloseHandle(handle);
for (size_t x = 0; x < ARRAYSIZE(flags); x++)
{
@ -113,7 +113,7 @@ static BOOL test_SetFileAttributesW(void)
FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
goto fail;
CloseHandle(handle);
(void)CloseHandle(handle);
for (size_t x = 0; x < ARRAYSIZE(flags); x++)
{

View File

@ -312,7 +312,7 @@ BOOL static_mutex_lock(volatile HANDLE* static_mutex)
return FALSE;
if (InterlockedCompareExchangePointer((PVOID*)static_mutex, (PVOID)handle, NULL) != NULL)
CloseHandle(handle);
(void)CloseHandle(handle);
}
return (WaitForSingleObject(*static_mutex, INFINITE) == WAIT_OBJECT_0);

View File

@ -84,7 +84,7 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg)
out:
free(lpReadBuffer);
free(lpWriteBuffer);
CloseHandle(hNamedPipe);
(void)CloseHandle(hNamedPipe);
if (!fSuccess)
testFailed = TRUE;
@ -179,7 +179,7 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg)
out:
free(lpReadBuffer);
free(lpWriteBuffer);
CloseHandle(hNamedPipe);
(void)CloseHandle(hNamedPipe);
if (!fSuccess)
testFailed = TRUE;
@ -379,15 +379,15 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
goto out;
}
}
CloseHandle(servers[i]);
CloseHandle(clients[i]);
(void)CloseHandle(servers[i]);
(void)CloseHandle(clients[i]);
numPipes--;
/**
* After CloseHandle (without calling DisconnectNamedPipe first) on server end
* ReadFile/WriteFile must fail on client end
*/
i = numPipes - 1;
CloseHandle(servers[i]);
(void)CloseHandle(servers[i]);
{
char sndbuf[PIPE_BUFFER_SIZE] = { 0 };
@ -409,14 +409,14 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
goto out;
}
}
CloseHandle(clients[i]);
(void)CloseHandle(clients[i]);
numPipes--;
/**
* After CloseHandle on client end
* ReadFile/WriteFile must fail on server end
*/
i = numPipes - 1;
CloseHandle(clients[i]);
(void)CloseHandle(clients[i]);
{
char sndbuf[PIPE_BUFFER_SIZE] = { 0 };
@ -440,15 +440,15 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
}
DisconnectNamedPipe(servers[i]);
CloseHandle(servers[i]);
(void)CloseHandle(servers[i]);
numPipes--;
/* Close all remaining pipes */
for (int i = 0; i < numPipes; i++)
{
DisconnectNamedPipe(servers[i]);
CloseHandle(servers[i]);
CloseHandle(clients[i]);
(void)CloseHandle(servers[i]);
(void)CloseHandle(clients[i]);
}
bSuccess = TRUE;
@ -503,8 +503,8 @@ int TestPipeCreateNamedPipe(int argc, char* argv[])
WaitForSingleObject(SingleThread, INFINITE);
WaitForSingleObject(ClientThread, INFINITE);
WaitForSingleObject(ServerThread, INFINITE);
CloseHandle(SingleThread);
CloseHandle(ClientThread);
CloseHandle(ServerThread);
(void)CloseHandle(SingleThread);
(void)CloseHandle(ClientThread);
(void)CloseHandle(ServerThread);
return testFailed;
}

View File

@ -146,9 +146,9 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg)
finish:
free(lpReadBuffer);
if (hNamedPipe)
CloseHandle(hNamedPipe);
(void)CloseHandle(hNamedPipe);
if (hEvent)
CloseHandle(hEvent);
(void)CloseHandle(hEvent);
return 0;
}
@ -324,8 +324,8 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg)
printf("server: finished successfully\n");
finish:
CloseHandle(hNamedPipe);
CloseHandle(hEvent);
(void)CloseHandle(hNamedPipe);
(void)CloseHandle(hEvent);
free(lpReadBuffer);
return 0;
}
@ -373,11 +373,11 @@ int TestPipeCreateNamedPipeOverlapped(int argc, char* argv[])
out:
if (ClientThread)
CloseHandle(ClientThread);
(void)CloseHandle(ClientThread);
if (ServerThread)
CloseHandle(ServerThread);
(void)CloseHandle(ServerThread);
if (serverReadyEvent)
CloseHandle(serverReadyEvent);
(void)CloseHandle(serverReadyEvent);
#ifndef _WIN32
if (result == 0)

View File

@ -65,8 +65,8 @@ int TestPipeCreatePipe(int argc, char* argv[])
return -1;
}
CloseHandle(hReadPipe);
CloseHandle(hWritePipe);
(void)CloseHandle(hReadPipe);
(void)CloseHandle(hWritePipe);
return 0;
}

View File

@ -101,7 +101,7 @@ static DWORD WINAPI thread_pool_work_func(LPVOID arg)
static void threads_close(void* thread)
{
WaitForSingleObject(thread, INFINITE);
CloseHandle(thread);
(void)CloseHandle(thread);
}
static BOOL InitializeThreadpool(PTP_POOL pool)
@ -190,7 +190,7 @@ VOID winpr_CloseThreadpool(PTP_POOL ptpp)
ArrayList_Free(ptpp->Threads);
Queue_Free(ptpp->PendingQueue);
CountdownEvent_Free(ptpp->WorkComplete);
CloseHandle(ptpp->TerminateEvent);
(void)CloseHandle(ptpp->TerminateEvent);
{
TP_POOL empty = { 0 };
@ -220,7 +220,7 @@ BOOL winpr_SetThreadpoolThreadMinimum(PTP_POOL ptpp, DWORD cthrdMic)
if (!ArrayList_Append(ptpp->Threads, thread))
{
CloseHandle(thread);
(void)CloseHandle(thread);
goto fail;
}
}

View File

@ -1461,7 +1461,7 @@ static HANDLE WINAPI PCSC_SCardAccessStartedEvent(void)
if (!SetEvent(g_StartedEvent))
{
CloseHandle(g_StartedEvent);
(void)CloseHandle(g_StartedEvent);
return NULL;
}
}
@ -1478,7 +1478,7 @@ static void WINAPI PCSC_SCardReleaseStartedEvent(void)
{
if (g_StartedEvent)
{
CloseHandle(g_StartedEvent);
(void)CloseHandle(g_StartedEvent);
g_StartedEvent = NULL;
}
}

View File

@ -116,7 +116,7 @@ BOOL WINAPI winpr_InitializeSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpB
if (!(hEvent1 = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
CloseHandle(hEvent0);
(void)CloseHandle(hEvent0);
return FALSE;
}
@ -249,10 +249,10 @@ BOOL WINAPI winpr_DeleteSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarri
SwitchToThread();
if (lpBarrier->Reserved3[0])
CloseHandle((HANDLE)lpBarrier->Reserved3[0]);
(void)CloseHandle((HANDLE)lpBarrier->Reserved3[0]);
if (lpBarrier->Reserved3[1])
CloseHandle((HANDLE)lpBarrier->Reserved3[1]);
(void)CloseHandle((HANDLE)lpBarrier->Reserved3[1]);
ZeroMemory(lpBarrier, sizeof(SYNCHRONIZATION_BARRIER));

View File

@ -66,7 +66,7 @@ static VOID CALLBACK Timer1APCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dw
{
UncleanCloseData* data = (UncleanCloseData*)lpArg;
data->timer1Calls++;
CloseHandle(data->timer2);
(void)CloseHandle(data->timer2);
data->endTest = TRUE;
}
@ -128,7 +128,7 @@ int TestSynchAPC(int argc, char* argv[])
if (!thread)
return 10;
WaitForSingleObject(thread, INFINITE);
CloseHandle(thread);
(void)CloseHandle(thread);
if (userApcArg.called || userApcArg.error)
return 11;
@ -142,7 +142,7 @@ int TestSynchAPC(int argc, char* argv[])
return 21;
WaitForSingleObject(thread, INFINITE);
CloseHandle(thread);
(void)CloseHandle(thread);
if (!userApcArg.called)
return 22;
@ -163,11 +163,11 @@ int TestSynchAPC(int argc, char* argv[])
return 33;
WaitForSingleObject(thread, INFINITE);
CloseHandle(thread);
(void)CloseHandle(thread);
if (uncleanCloseData.timer1Calls != 1 || uncleanCloseData.timer2Calls != 0)
return 34;
CloseHandle(uncleanCloseData.timer1);
(void)CloseHandle(uncleanCloseData.timer1);
#endif
return 0;
}

View File

@ -263,7 +263,7 @@ static DWORD WINAPI TestSynchCritical_Main(LPVOID arg)
dwThreadExitCode);
goto fail;
}
CloseHandle(hThreads[i]);
(void)CloseHandle(hThreads[i]);
}
if (gTestValueVulnerable != gTestValueSerialized)
@ -308,7 +308,7 @@ static DWORD WINAPI TestSynchCritical_Main(LPVOID arg)
dwThreadExitCode);
goto fail;
}
CloseHandle(hThread);
(void)CloseHandle(hThread);
*pbThreadTerminated = TRUE; /* requ. for winpr issue, see below */
return 0;
@ -362,7 +362,7 @@ int TestSynchCritical(int argc, char* argv[])
}
GetExitCodeThread(hThread, &dwThreadExitCode);
CloseHandle(hThread);
(void)CloseHandle(hThread);
if (dwThreadExitCode != 0)
{

View File

@ -88,7 +88,7 @@ int TestSynchEvent(int argc, char* argv[])
return -1;
}
CloseHandle(event);
(void)CloseHandle(event);
return 0;
}

View File

@ -155,11 +155,11 @@ out:
winpr_aligned_free(pTestOnceFunctionCalls);
winpr_aligned_free(pInitOnceExecuteOnceCalls);
CloseHandle(hStartEvent);
(void)CloseHandle(hStartEvent);
for (DWORD i = 0; i < dwCreatedThreads; i++)
{
CloseHandle(hThreads[i]);
(void)CloseHandle(hThreads[i]);
}
return (result ? 0 : 1);

View File

@ -223,18 +223,18 @@ static BOOL test_mutex_threading(void)
goto fail;
}
CloseHandle(hThread);
CloseHandle(hStartEvent);
CloseHandle(thread1_mutex1);
CloseHandle(thread1_mutex2);
(void)CloseHandle(hThread);
(void)CloseHandle(hStartEvent);
(void)CloseHandle(thread1_mutex1);
(void)CloseHandle(thread1_mutex2);
return TRUE;
fail:
(void)ReleaseMutex(thread1_mutex1);
(void)ReleaseMutex(thread1_mutex2);
CloseHandle(thread1_mutex1);
CloseHandle(thread1_mutex2);
CloseHandle(hStartEvent);
CloseHandle(hThread);
(void)CloseHandle(thread1_mutex1);
(void)CloseHandle(thread1_mutex2);
(void)CloseHandle(hStartEvent);
(void)CloseHandle(hThread);
return FALSE;
}

View File

@ -15,7 +15,7 @@ int TestSynchSemaphore(int argc, char* argv[])
return -1;
}
CloseHandle(semaphore);
(void)CloseHandle(semaphore);
return 0;
}

Some files were not shown because too many files have changed in this diff Show More