diff --git a/cv5/a_train.c b/cv5/a_train.c index 3056cd4..c18af36 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -84,10 +84,12 @@ struct car* clear_train(struct car* first, const char* target) { while(this != NULL){ int x = strcmp(this->value, target); if(x == 0){ + first = this->next; + free(this) this->next = NULL; //free(this->next); - return this; + return first; } this = this->next; }