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