diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-06-15 23:35:36 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-16 13:22:03 -0700 |
commit | 5a09991e32f3487702bd032703bacba1c4c46612 (patch) | |
tree | 9acdc7648fbdb18f4487a74895e4f5aba1cd86b9 | |
parent | 8168d5e9c23ed44ae3d604f392320d66556453c9 (diff) | |
download | git-5a09991e32f3487702bd032703bacba1c4c46612.tar.gz |
fsmonitor: avoid memory leak in `fsm_settings__get_incompatible_msg()`
Reported by Coverity.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | fsmonitor-settings.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fsmonitor-settings.c b/fsmonitor-settings.c index 658cb79da0..464424a1e9 100644 --- a/fsmonitor-settings.c +++ b/fsmonitor-settings.c @@ -202,11 +202,15 @@ char *fsm_settings__get_incompatible_msg(const struct repository *r, case FSMONITOR_REASON_OK: goto done; - case FSMONITOR_REASON_BARE: + case FSMONITOR_REASON_BARE: { + char *cwd = xgetcwd(); + strbuf_addf(&msg, _("bare repository '%s' is incompatible with fsmonitor"), - xgetcwd()); + cwd); + free(cwd); goto done; + } case FSMONITOR_REASON_ERROR: strbuf_addf(&msg, |