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

[PATCH 2/2] fsmonitor: do not forget to release the token in `discard_index()`

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 17, 2021, 15:30 UTC
Message-ID
<2b4dd0c9160ebf1d676c63585869f1a35da1a0bd.1615995049.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.891.git.1615995049.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

In 56c6910028a (fsmonitor: change last update timestamp on the index_state to opaque token, 2020-01-07), we forgot to adjust `discard_index()` to release the "last-update" token: it is no longer a 64-bit number, but a free-form string that has been allocated.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 read-cache.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/read-cache.c b/read-cache.c
index aa427c5c170f..cf5ff3158550 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2364,6 +2364,7 @@ int discard_index(struct index_state *istate)
 	cache_tree_free(&(istate->cache_tree));
 	istate->initialized = 0;
 	istate->fsmonitor_has_run_once = 0;
+	FREE_AND_NULL(istate->fsmonitor_last_update);
 	FREE_AND_NULL(istate->cache);
 	istate->cache_alloc = 0;
 	discard_split_index(istate);
-- 
gitgitgadget
Previous: Junio C HamanoNext: Derrick Stolee
Message 4 of 6 in “Fix memory corruption with FSMonitor-enabled unpack_trees()”
  1. 0/2 Fix memory corruption with FSMonitor-enabled unpack_trees()Johannes Schindelin via GitGitGadget, Mar 17, 2021
  2. 1/2 fsmonitor: fix memory corruption in some corner casesJohannes Schindelin via GitGitGadget, Mar 17, 2021
  3. Junio C HamanoMar 17, 2021
  4. 2/2 fsmonitor: do not forget to release the token in `discard_index()`Johannes Schindelin via GitGitGadget, Mar 17, 2021
  5. Derrick StoleeMar 17, 2021
  6. Johannes SchindelinMar 19, 2021

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.