Fixed resource leaks.
authorArmin Novak <anovak@thinstuff.com>
Tue, 13 Aug 2013 14:04:19 +0000 (16:04 +0200)
committerArmin Novak <anovak@thinstuff.com>
Wed, 14 Aug 2013 11:23:54 +0000 (13:23 +0200)
channels/parallel/client/parallel_main.c
channels/serial/client/serial_main.c

index 6e35c1e..16bf4bb 100644 (file)
@@ -286,6 +286,7 @@ static void parallel_free(DEVICE* device)
        MessageQueue_PostQuit(parallel->queue, 0);
        WaitForSingleObject(parallel->thread, INFINITE);
 
+       Stream_Free(parallel->device.data, TRUE);
        MessageQueue_Free(parallel->queue);
        CloseHandle(parallel->thread);
 
index 80be6c8..cb0852a 100644 (file)
@@ -365,10 +365,16 @@ static void serial_free(DEVICE* device)
 
        DEBUG_SVC("freeing device");
 
+       /* Stop thread */
        SetEvent(serial->stopEvent);
-
-       /* TODO: free lists */
-
+       WaitForSingleObject(serial->thread, INFINITE);
+
+       /* 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);
 }