diff --git a/cv5/a_train.c b/cv5/a_train.c index 8bb0856..bd52d79 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -37,6 +37,10 @@ void cancel_train(struct car* first) { if(first == NULL){ exit(0); } + else if(first->next == NULL){ + free(first->next); + exit(0); + } cancel_train(first->next); free(first); }