This commit is contained in:
Maryna Kravtsova 2020-11-02 14:29:23 +01:00
parent 3caa2bbe73
commit 6eef97b6ce

View File

@ -7,9 +7,8 @@
struct car* add_car(struct car* first,const char* target) { struct car* add_car(struct car* first,const char* target) {
struct car* newcar = calloc(1, sizeof(struct car)); struct car* newcar = calloc(1, sizeof(struct car));
if(target == NULL){ if(target == NULL){
exit(0); return;
} }
strcpy(newcar->value, target); strcpy(newcar->value, target);
if(first == NULL){ if(first == NULL){
@ -47,7 +46,7 @@ void cancel_train(struct car* first) {
cancel_train(first->next); cancel_train(first->next);
first->next = NULL; first->next = NULL;
} }
if(first->next == NULL){ else if(first->next == NULL){
free(first); free(first);
} }