This commit is contained in:
Maryna Kravtsova 2020-10-27 16:42:05 +01:00
parent 0e2548ede3
commit 5b3d26ec92

View File

@ -38,8 +38,9 @@ void cancel_train(struct car* first) {
exit(0); exit(0);
} }
if(first->next == NULL){ if(first->next == NULL){
free(first); struct car *this = first;
first = NULL; first = fitst->next;
free(this);
exit(0); exit(0);
} }
cancel_train(first->next); cancel_train(first->next);