From 1fc8770eab0088d2bf91693bbc30910d2acc1be5 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Tue, 3 Nov 2020 22:16:01 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index 0116f41..7ad32a8 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -88,7 +88,7 @@ struct car* clear_train(struct car* first, const char* target) { if(first == this){ first = this->next; free(this); - first->next = NULL; + //first->next = NULL; return first; } while(curr != this){ @@ -97,6 +97,7 @@ struct car* clear_train(struct car* first, const char* target) { } prev->next = curr->next; + first->next = NULL: free(this); } this = this->next;