{"thread":{"id":"57328","subject":"[PATCH] sparse-checkout: fix a couple minor memory leaks","startedAt":"2022-01-28T01:58:22Z","lastAt":"2022-01-28T15:04:48Z","messageCount":2,"participants":["Elijah Newren via GitGitGadget","Derrick Stolee"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"447168","messageId":"pull.1189.git.git.1643335098710.gitgitgadget@gmail.com","threadId":"57328","inReplyTo":null,"subject":"[PATCH] sparse-checkout: fix a couple minor memory leaks","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-01-28T01:58:18Z","receivedAt":"2022-01-28T01:58:22Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nThese were introduced in commit 55dfcf9591 (\"sparse-checkout: clear\ntracked sparse dirs\", 2021-09-08) and missed in my review at the time.\nPlug the leaks.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n    sparse-checkout: fix a couple minor memory leaks\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1189%2Fnewren%2Fsparse-directory-cleaning-memleaks-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1189/newren/sparse-directory-cleaning-memleaks-v1\nPull-Request: https://github.com/git/git/pull/1189\n\n builtin/sparse-checkout.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 679c1070368..c655517e019 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -185,6 +185,8 @@ static void clean_tracked_sparse_directories(struct repository *r)\n \t\t\t\titem->string);\n \t\t}\n \n+\t\tstrvec_clear(&s);\n+\t\tclear_pathspec(&p);\n \t\tdir_clear(&dir);\n \t}\n \n\nbase-commit: 1ffcbaa1a5f10c9f706314d77f88de20a4a498c2\n-- \ngitgitgadget\n"},{"id":"447217","messageId":"2bea96f1-48dd-884f-244c-479d635487f1@gmail.com","threadId":"57328","inReplyTo":"pull.1189.git.git.1643335098710.gitgitgadget@gmail.com","subject":"Re: [PATCH] sparse-checkout: fix a couple minor memory leaks","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2022-01-28T15:04:43Z","receivedAt":"2022-01-28T15:04:48Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 1/27/2022 8:58 PM, Elijah Newren via GitGitGadget wrote:\n> From: Elijah Newren <newren@gmail.com>\n> \n> These were introduced in commit 55dfcf9591 (\"sparse-checkout: clear\n> tracked sparse dirs\", 2021-09-08) and missed in my review at the time.\n> Plug the leaks.\n> \n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n>     sparse-checkout: fix a couple minor memory leaks\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1189%2Fnewren%2Fsparse-directory-cleaning-memleaks-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1189/newren/sparse-directory-cleaning-memleaks-v1\n> Pull-Request: https://github.com/git/git/pull/1189\n> \n>  builtin/sparse-checkout.c | 2 ++\n>  1 file changed, 2 insertions(+)\n> \n> diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\n> index 679c1070368..c655517e019 100644\n> --- a/builtin/sparse-checkout.c\n> +++ b/builtin/sparse-checkout.c\n> @@ -185,6 +185,8 @@ static void clean_tracked_sparse_directories(struct repository *r)\n>  \t\t\t\titem->string);\n>  \t\t}\n>  \n> +\t\tstrvec_clear(&s);\n> +\t\tclear_pathspec(&p);\n>  \t\tdir_clear(&dir);\n>  \t}\n\nSimple enough. Thanks for catching and fixing this.\n\n-Stolee\n\n"}]}