From df034f6c6de39a024676b1563a86434c7d68c246 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Mon, 2 Nov 2020 14:46:04 +0100 Subject: [PATCH] add --- cv5/a_train.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index d2ee26a..3c6f15a 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -40,14 +40,14 @@ void print_train(struct car* first) { void cancel_train(struct car* first) { if(first == NULL){ - exit(0); + return; } - if(first->next != NULL){ + else if(first->next != NULL){ cancel_train(first->next); first->next = NULL; - //free(first); + free(first); } - if(first->next == NULL){ + else if(first->next == NULL){ free(first); }