TP_9 exo1: Fix the linked list freeing function to properly go to the
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 28 Feb 2017 14:53:17 +0000 (15:53 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 28 Feb 2017 14:53:17 +0000 (15:53 +0100)
next link.

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP_9/exo1/clist.c

index 69fd8ccb74ffc088389398e7fad59a3a9e8eab4e..87f97a7a5f994be611ff29afe8e9d50df386f719 100644 (file)
@@ -44,7 +44,7 @@ int list_get(link_t* head, unsigned index) {
 void list_clear(link_t* link) {
 
     while (link != NULL) {
-        link_t* next_link = link;
+        link_t* next_link = link->next;
         free(link);
         link = next_link;
     }