From 6eef97b6ce846a6a58b357b222297e424900691e Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Mon, 2 Nov 2020 14:29:23 +0100 Subject: [PATCH] add --- cv5/a_train.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index ceb0ce9..a4318f1 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -7,9 +7,8 @@ struct car* add_car(struct car* first,const char* target) { struct car* newcar = calloc(1, sizeof(struct car)); if(target == NULL){ - exit(0); + return; } - strcpy(newcar->value, target); if(first == NULL){ @@ -47,7 +46,7 @@ void cancel_train(struct car* first) { cancel_train(first->next); first->next = NULL; } - if(first->next == NULL){ + else if(first->next == NULL){ free(first); }