TP_9 exo1: Fix the linked list freeing function to properly go to the
[TD_C.git] / 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;
     }