aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--queue.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/queue.c b/queue.c
index c8ec31e..e26acbb 100644
--- a/queue.c
+++ b/queue.c
@@ -63,6 +63,17 @@ queue_empty(struct queue *queue)
63 return queue->head == NULL; 63 return queue->head == NULL;
64} 64}
65 65
66void
67queue_free(struct queue *queue)
68{
69 struct queue_item *item, *next;
70
71 for ( item = queue->head; item; item = next ) {
72 next = item->next;
73 free(item);
74 }
75}
76
66int 77int
67main() 78main()
68{ 79{
@@ -80,5 +91,8 @@ main()
80 else 91 else
81 ERROR("this shouldn't happen!"); 92 ERROR("this shouldn't happen!");
82 } 93 }
94
95 queue_free(queue);
96
83 return EXIT_SUCCESS; 97 return EXIT_SUCCESS;
84} 98}