fixing the memomory leak

This commit is contained in:
Anton Dolozin 2025-10-28 20:28:48 +01:00
parent 50295427c8
commit 9f3eca6dd3

View File

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