On Mon, Oct 10, 2022 at 04:37:25PM -0700, Junio C Hamano wrote: > * 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@xxxxxxxxx> 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@xxxxxxxx> --- 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