From 33dc166873e24797264f001018e04666967c1d6b Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Mon, 2 Nov 2020 15:15:09 +0100 Subject: [PATCH] car --- cv5/a_train.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index 9eebf7d..46157e3 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -8,7 +8,7 @@ struct car* add_car(struct car* first,const char* target) { struct car* newcar = calloc(1, sizeof(struct car)); if(target == NULL){ - return; + exit(0); } strcpy(newcar->value, target); @@ -47,11 +47,11 @@ void cancel_train(struct car* first) { cancel_train(first->next); first->next = NULL; } - //else if(first->next == NULL){ - //free(first); + if(first->next == NULL){ + free(first); // cancel_train(first->next); - // } - free(first); + } + //free(first); }