From 0dbae9bb1846ea279bc1c97f03f4499d5ac4490e Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Thu, 6 Aug 2020 09:09:01 +0200 Subject: Fix: queue_free() hinzugefügt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- queue.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'queue.c') 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) return queue->head == NULL; } +void +queue_free(struct queue *queue) +{ + struct queue_item *item, *next; + + for ( item = queue->head; item; item = next ) { + next = item->next; + free(item); + } +} + int main() { @@ -80,5 +91,8 @@ main() else ERROR("this shouldn't happen!"); } + + queue_free(queue); + return EXIT_SUCCESS; } -- cgit v1.3