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

Re: What's cooking in git.git (Oct 2022, #03; Mon, 10)

From
Jeff King <peff@peff.net>
Date
Oct 11, 2022, 00:42 UTC
Message-ID
<Y0S7/jA5tNeoQ2Hm@coredump.intra.peff.net>
In-Reply-To
<xmqqlepnz1vu.fsf@gitster.g>
On Mon, Oct 10, 2022 at 04:37:25PM -0700, Junio C Hamano wrote:
Show 15 quoted lines
> * ed/fsmonitor-on-networked-macos (2022-10-05) 6 commits
>   (merged to 'next' on 2022-10-07 at fe9f182bde)
>  + fsmonitor: add documentation for allowRemote and socketDir options
>  + fsmonitor: check for compatability before communicating with fsmonitor
>  + fsmonitor: deal with synthetic firmlinks on macOS
>  + fsmonitor: avoid socket location check if using hook
>  + fsmonitor: relocate socket file if .git directory is remote
>  + fsmonitor: refactor filesystem checks to common interface
>  (this branch is used by ed/fsmonitor-inotify.)
> 
>  By default, use of fsmonitor on a repository on networked
>  filesystem is disabled. Add knobs to make it workable on macOS.
> 
>  Will merge to 'master'.
>  source: <pull.1326.v15.git.1664904751.gitgitgadget@gmail.com>
There's a tiny leak in this one. Here's a fix that can go on top.
-- >8 --
Subject: [PATCH] fsmonitor: fix leak of warning message

The fsm_settings__get_incompatible_msg() function returns an allocated string. So we can't pass its result directly to warning(); we must hold on to the pointer and free it to avoid a leak.

The leak here is small and fixed size, but Coverity complained, and presumably SANITIZE=leaks would eventually.

Signed-off-by: Jeff King <peff@peff.net>
---
 fsmonitor.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fsmonitor.c b/fsmonitor.c
index 540736b39f..08af00c738 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -309,8 +309,10 @@ void refresh_fsmonitor(struct index_state *istate)
 	enum fsmonitor_reason reason = fsm_settings__get_reason(r);
 
 	if (!warn_once && reason > FSMONITOR_REASON_OK) {
+		char *msg = fsm_settings__get_incompatible_msg(r, reason);
 		warn_once = 1;
-		warning("%s", fsm_settings__get_incompatible_msg(r, reason));
+		warning("%s", msg);
+		free(msg);
 	}
 
 	if (fsm_mode <= FSMONITOR_MODE_DISABLED ||
-- 
2.38.0.705.gfa933d7c31
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 8 in “What's cooking in git.git (Oct 2022, #03; Mon, 10)”
  1. Junio C HamanoOct 10, 2022
  2. Jeff KingOct 11, 2022
  3. Junio C HamanoOct 11, 2022
  4. Jeff KingOct 11, 2022
  5. Johannes SchindelinDec 20, 2022
  6. Jeff KingDec 21, 2022
  7. Ævar Arnfjörð BjarmasonDec 22, 2022
  8. Jeff KingDec 22, 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.