X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_8%2Fexo3%2Fexo3.c;fp=TP_8%2Fexo3%2Fexo3.c;h=2c433a5f90a7246ed3c3764167deea711528207e;hb=00d88568ddfaf33eca5b6bac058b4e5ada15cc41;hp=6c2d6c542e57002d476eb7763eae10a6ac55d9af;hpb=edbb50f74ef3aee9cb8119a54143ba845e3b6de0;p=TD_C.git diff --git a/TP_8/exo3/exo3.c b/TP_8/exo3/exo3.c index 6c2d6c5..2c433a5 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; + free(link); + link = next_link; + } } int main() {