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); }