diff --git a/cv5/a_train.c b/cv5/a_train.c index b1d3454..fe10f4b 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -43,15 +43,13 @@ void cancel_train(struct car* first) { if(first == NULL){ exit(0); } - if(first->next == NULL){ - struct car* this = first; - first = first->next; - free(this); - first = NULL; + else if(first->next == NULL){ + free(first); + //first = NULL; } else{ cancel_train(first->next); - free(first); + first->next = NULL; } }