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>
This commit is contained in:

committed by
Junio C Hamano

parent
8168d5e9c2
commit
5a09991e32
@ -202,11 +202,15 @@ char *fsm_settings__get_incompatible_msg(const struct repository *r,
|
|||||||
case FSMONITOR_REASON_OK:
|
case FSMONITOR_REASON_OK:
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
case FSMONITOR_REASON_BARE:
|
case FSMONITOR_REASON_BARE: {
|
||||||
|
char *cwd = xgetcwd();
|
||||||
|
|
||||||
strbuf_addf(&msg,
|
strbuf_addf(&msg,
|
||||||
_("bare repository '%s' is incompatible with fsmonitor"),
|
_("bare repository '%s' is incompatible with fsmonitor"),
|
||||||
xgetcwd());
|
cwd);
|
||||||
|
free(cwd);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
case FSMONITOR_REASON_ERROR:
|
case FSMONITOR_REASON_ERROR:
|
||||||
strbuf_addf(&msg,
|
strbuf_addf(&msg,
|
||||||
|
Reference in New Issue
Block a user