Memory leak
This commit is contained in:
parent
2d799d2ae9
commit
fad44068a8
@ -68,10 +68,10 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
prev = temp;
|
prev = temp;
|
||||||
temp = temp->next;
|
temp = temp->next;
|
||||||
if(strcmp(temp->value, target) == 0){
|
if(strcmp(temp->value, target) == 0){
|
||||||
|
struct car* next = temp->next;
|
||||||
prev->next = temp->next;
|
prev->next = next;
|
||||||
free(temp);
|
free(temp);
|
||||||
temp = prev->next;
|
temp = next;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user