Fix a memory leak associated with queues.