diff --git a/cv5/a_train.c b/cv5/a_train.c index d2ee26a..3c6f15a 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -40,14 +40,14 @@ void print_train(struct car* first) { void cancel_train(struct car* first) { if(first == NULL){ - exit(0); + return; } - if(first->next != NULL){ + else if(first->next != NULL){ cancel_train(first->next); first->next = NULL; - //free(first); + free(first); } - if(first->next == NULL){ + else if(first->next == NULL){ free(first); }