On Mon, Sep 19, 2022 at 3:38 PM Eric DeCosta via GitGitGadget <gitgitgadget@xxxxxxxxx> wrote: > If the .git directory is on a remote file system, create the socket > file in 'fsmonitor.socketDir' if it is defined, else create it in $HOME. > > Signed-off-by: Eric DeCosta <edecosta@xxxxxxxxxxxxx> > --- > diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c > @@ -0,0 +1,48 @@ > +const char *fsmonitor_ipc__get_path(struct repository *r) > +{ > + char *sock_dir; > + > + repo_config_get_string(r, "fsmonitor.socketdir", &sock_dir); > + > + /* Create the socket file in either socketDir or $HOME */ > + if (sock_dir && *sock_dir) { > + strbuf_addf(&ipc_file, "%s/.git-fsmonitor-%s", > + sock_dir, hash_to_hex(hash)); > + free(sock_dir); > + } else { > + strbuf_addf(&ipc_file, "~/.git-fsmonitor-%s", hash_to_hex(hash)); > + } This is still leaking `sock_dir`, isn't it, if repo_config_get_string() returns it as a zero-length string? Probably want to move free() below the entire conditional. > diff --git a/compat/fsmonitor/fsm-ipc-win32.c b/compat/fsmonitor/fsm-ipc-win32.c > @@ -0,0 +1,9 @@ > +#include "config.h" > +#include "fsmonitor-ipc.h" > + > +const char *fsmonitor_ipc__get_path(struct repository *r) { > + static char *ret; > + if (!ret) > + ret = git_pathdup("fsmonitor--daemon.ipc"); > + return ret; > +} > \ No newline at end of file Still an incomplete line.