From b24ca86e2094aa92ab862ab06f8c85baa786078d Mon Sep 17 00:00:00 2001 From: weiss-ben Date: Fri, 23 Sep 2022 16:28:04 +0300 Subject: [PATCH] fix: clang-tidy fixes --- search/median_search2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/search/median_search2.cpp b/search/median_search2.cpp index 57309e70d..9d99b3c5d 100644 --- a/search/median_search2.cpp +++ b/search/median_search2.cpp @@ -97,8 +97,9 @@ static void test() { // Clean up while (head) { - ListNode* t = head->next; - delete head; + ListNode* t = head; + head = head->next; + delete t; } head = new ListNode; @@ -106,7 +107,7 @@ static void test() { temp1 = head; for (int i = 1; i < 7; ++i) { - ListNode* temp2 = new ListNode; + auto temp2 = new ListNode; temp2->val = i; temp1->next = temp2;