This commit is contained in:
Maryna Kravtsova 2020-11-02 14:27:52 +01:00
parent acd98c9e47
commit 3caa2bbe73

View File

@ -43,12 +43,12 @@ void cancel_train(struct car* first) {
if(first == NULL){ if(first == NULL){
return; return;
} }
if(first->next == NULL){ if(first->next != NULL){
free(first); cancel_train(first->next);
first->next = NULL;
} }
else if(first->next != NULL){ if(first->next == NULL){
cancel_train(first->next); free(first);
first->next = NULL;
} }
} }