X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_8%2Fexo3%2Fexo3.c;h=6f9cb34c228bae34b4c0e72160e629e0bac04ccf;hb=HEAD;hp=6c2d6c542e57002d476eb7763eae10a6ac55d9af;hpb=913777a2bfd77759b7da95a3b5ab07b5d6cdf8fc;p=TD_C.git diff --git a/TP_8/exo3/exo3.c b/TP_8/exo3/exo3.c index 6c2d6c5..6f9cb34 100644 --- a/TP_8/exo3/exo3.c +++ b/TP_8/exo3/exo3.c @@ -55,7 +55,12 @@ int list_get(link_t* head, unsigned index) { } void list_clear(link_t* link) { - free(link); + + while (link != NULL) { + link_t* next_link = link->next; + free(link); + link = next_link; + } } int main() {