зеркало из https://github.com/microsoft/git.git
setup: free old value before setting `work_tree`
Before assigning to `data->work_tree` in `read_worktree_config()`, free any value we might already have picked up, so that we do not leak it. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
ecbdaf0899
Коммит
13019979b8
1
setup.c
1
setup.c
|
@ -411,6 +411,7 @@ static int read_worktree_config(const char *var, const char *value, void *vdata)
|
|||
} else if (strcmp(var, "core.worktree") == 0) {
|
||||
if (!value)
|
||||
return config_error_nonbool(var);
|
||||
free(data->work_tree);
|
||||
data->work_tree = xstrdup(value);
|
||||
}
|
||||
return 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче