The destroy function leaks the memory of the nodes. You need to loop over the queue and free each node one by one.
The destroy function leaks the memory of the nodes. You need to loop over the queue and free each node one by one.