Memory leak

This commit is contained in:
Anton Dolozin 2025-10-28 20:36:49 +01:00
parent 2d799d2ae9
commit fad44068a8

View File

@ -68,10 +68,10 @@ struct car* clear_train(struct car* first, const char* target) {
prev = temp;
temp = temp->next;
if(strcmp(temp->value, target) == 0){
prev->next = temp->next;
struct car* next = temp->next;
prev->next = next;
free(temp);
temp = prev->next;
temp = next;
}