Plugged memory error

This commit is contained in:
Anton Dolozin 2025-11-04 23:04:31 +01:00
parent 179d3f1e65
commit 7bf031d671

View File

@ -41,11 +41,16 @@ void add_target_capacity(struct station* station,const char* target, int capacit
}
if(count < res){
struct car* next = (struct car*)calloc(10, sizeof(struct car));
struct car* next = (struct car*)calloc(1, sizeof(struct car));
strcpy(next->value, target);
next->capacity = capacity;
if(ptr){
ptr->next = next;
return;
return;}
else{
*station->tracks = next;
return;
}
}
ptr->capacity += capacity;