This commit is contained in:
Maryna Kravtsova 2020-11-04 23:20:00 +01:00
parent c973646eae
commit 46d03ac3ad

View File

@ -73,13 +73,14 @@ struct car* clear_train(struct car* first, const char* target) {
free(this); free(this);
return first; return first;
} }
else if(this->next->next == NULL){ else {
while(tmp->next != NULL){ while(tmp->next != NULL){
prev = tmp; prev = tmp;
tmp = tmp->next; tmp = tmp->next;
} }
free(tmp); free(tmp);
prev->next = NULL; prev->next = NULL;
return this;
} }
} }
this = this->next; this = this->next;