Plugged memory error
This commit is contained in:
parent
179d3f1e65
commit
7bf031d671
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user