Fixed resource leaks.

This commit is contained in:
Armin Novak 2013-08-13 16:04:19 +02:00
parent 7d27062edd
commit 1d2adcbe26
2 changed files with 9 additions and 2 deletions

View File

@ -286,6 +286,7 @@ static void parallel_free(DEVICE* device)
MessageQueue_PostQuit(parallel->queue, 0); MessageQueue_PostQuit(parallel->queue, 0);
WaitForSingleObject(parallel->thread, INFINITE); WaitForSingleObject(parallel->thread, INFINITE);
Stream_Free(parallel->device.data, TRUE);
MessageQueue_Free(parallel->queue); MessageQueue_Free(parallel->queue);
CloseHandle(parallel->thread); CloseHandle(parallel->thread);

View File

@ -365,10 +365,16 @@ static void serial_free(DEVICE* device)
DEBUG_SVC("freeing device"); DEBUG_SVC("freeing device");
/* Stop thread */
SetEvent(serial->stopEvent); SetEvent(serial->stopEvent);
WaitForSingleObject(serial->thread, INFINITE);
/* TODO: free lists */ /* Clean up resources */
Stream_Free(serial->device.data, TRUE);
Queue_Free(serial->queue);
list_free(serial->pending_irps);
CloseHandle(serial->stopEvent);
CloseHandle(serial->thread);
free(serial); free(serial);
} }