Skip to content

Commit 5a09991

Browse files
dschogitster
authored andcommitted
fsmonitor: avoid memory leak in fsm_settings__get_incompatible_msg()
Reported by Coverity. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8168d5e commit 5a09991

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fsmonitor-settings.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,15 @@ char *fsm_settings__get_incompatible_msg(const struct repository *r,
202202
case FSMONITOR_REASON_OK:
203203
goto done;
204204

205-
case FSMONITOR_REASON_BARE:
205+
case FSMONITOR_REASON_BARE: {
206+
char *cwd = xgetcwd();
207+
206208
strbuf_addf(&msg,
207209
_("bare repository '%s' is incompatible with fsmonitor"),
208-
xgetcwd());
210+
cwd);
211+
free(cwd);
209212
goto done;
213+
}
210214

211215
case FSMONITOR_REASON_ERROR:
212216
strbuf_addf(&msg,

0 commit comments

Comments
 (0)