From 798696cff740908799499a63bb6fb8f57ea1b9b6 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Mon, 26 Oct 2020 17:49:41 +0100 Subject: [PATCH] train --- cv5/a_train.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cv5/a_train.c b/cv5/a_train.c index 8bb0856..bd52d79 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -37,6 +37,10 @@ void cancel_train(struct car* first) { if(first == NULL){ exit(0); } + else if(first->next == NULL){ + free(first->next); + exit(0); + } cancel_train(first->next); free(first); }