From 7fc338d0fdb75590da946ff99e38883cfb89772b Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 31 Aug 2024 02:33:44 +0200 Subject: [PATCH 1/2] fix: use `GITHUB_ACTOR` in `git config` (#2673) --- .github/workflows/gh-pages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index b795dcadb56..3384cf859bf 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -25,8 +25,8 @@ jobs: clean: false - name: Move & Commit files run: | - git config --global user.name github-actions - git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com' + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY rm -rf d* && rm *.html && rm *.svg && rm *.map && rm *.md5 && rm *.png && rm *.js && rm *.css git add . From 8bde3ea612448b0d5fdbd2f092429e86de03ca62 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 31 Aug 2024 02:37:42 +0200 Subject: [PATCH 2/2] fix: remove memory leak in `sublist_search.cpp` (#2541) Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com> --- search/sublist_search.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/search/sublist_search.cpp b/search/sublist_search.cpp index 9f854ce5702..0954173d20c 100644 --- a/search/sublist_search.cpp +++ b/search/sublist_search.cpp @@ -90,6 +90,20 @@ Node *makeLinkedList(const std::vector &data) { return head; } +/* + * @brief This function dealocates memory related to the given list + * It recursively deletes all of the nodes of the input list. + * @param room the root/head of the input list + * @warning Plese note that the memory for each node has to be alocated using + * new. + */ +void deleteList(Node *const root) { + if (root != NULL) { + deleteList(root->next); + delete root; + } +} + /** * @brief Main searching function * @param sublist A linked list which is supposed to be searched in mainList. @@ -217,8 +231,8 @@ class TestCases { log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "~"); - delete (sublistLL); - delete (mainlistLL); + deleteList(mainlistLL); + deleteList(sublistLL); } /** @@ -270,6 +284,9 @@ class TestCases { log("[PASS] : TEST CASE 2 PASS!"); log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "~"); + + deleteList(mainlistLL); + deleteList(sublistLL); } /** @@ -318,6 +335,9 @@ class TestCases { log("[PASS] : TEST CASE 3 PASS!"); log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "~"); + + deleteList(mainlistLL); + deleteList(sublistLL); } }; @@ -366,5 +386,8 @@ int main(int argc, char *argv[]) { } else { std::cout << "[FALSE] - sublist NOT found in main list\n"; } + + deleteList(mainlistLL); + deleteList(sublistLL); return 0; }