From fad44068a8484c65a4fd42ceec13f426d5a3b682 Mon Sep 17 00:00:00 2001 From: Anton Dolozin Date: Tue, 28 Oct 2025 20:36:49 +0100 Subject: [PATCH] Memory leak --- du4/a_train.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/du4/a_train.c b/du4/a_train.c index 1321d8f..241bbbd 100644 --- a/du4/a_train.c +++ b/du4/a_train.c @@ -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; }