From 8d777667f628c00498a9077760c26d05651cb6c6 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Thu, 5 Nov 2020 15:34:20 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index e4dc4bb..af518c1 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -66,10 +66,9 @@ struct car* clear_train(struct car* first, const char* target) { while(prev->next->next != NULL){ int x = strcmp(first->value, target); if(x == 0){ - //first = NULL; first = first->next; - free(first); - return first->next; + free(prev); + return first; } x = strcmp(prev->next->value, target);