git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] sparse-checkout: fix a couple minor memory leaks

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Jan 28, 2022, 01:58 UTC
Message-ID
<pull.1189.git.git.1643335098710.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

These were introduced in commit 55dfcf9591 ("sparse-checkout: clear tracked sparse dirs", 2021-09-08) and missed in my review at the time. Plug the leaks.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
    sparse-checkout: fix a couple minor memory leaks
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1189%2Fnewren%2Fsparse-directory-cleaning-memleaks-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1189/newren/sparse-directory-cleaning-memleaks-v1
Pull-Request: https://github.com/git/git/pull/1189
 builtin/sparse-checkout.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index 679c1070368..c655517e019 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -185,6 +185,8 @@ static void clean_tracked_sparse_directories(struct repository *r)
 				item->string);
 		}
 
+		strvec_clear(&s);
+		clear_pathspec(&p);
 		dir_clear(&dir);
 	}
 

base-commit: 1ffcbaa1a5f10c9f706314d77f88de20a4a498c2
-- 
gitgitgadget
Next: Derrick Stolee
Message 1 of 2 in “sparse-checkout: fix a couple minor memory leaks”
  1. sparse-checkout: fix a couple minor memory leaksElijah Newren via GitGitGadget, Jan 28, 2022
  2. Derrick StoleeJan 28, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.