From 33199226530d2124442ce5c3850ac9b064432ae2 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Wed, 4 Nov 2020 13:12:42 +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 a7c8791..2e52925 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -69,6 +69,7 @@ struct car* clear_train(struct car* first, const char* target) { struct car* third = prev->next->next; free(prev->next); prev->next = third; + first->next = NULL; return first; } prev = prev->next; @@ -76,7 +77,7 @@ struct car* clear_train(struct car* first, const char* target) { int x = strcmp(prev->next->value, target); if(x == 0){ free(prev->next); - prev->next->next = NULL; + prev->next = NULL; return first; }