Skip to content

Commit 1301997

Browse files
Martin Ågrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ecbdaf0 commit 1301997

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ static int read_worktree_config(const char *var, const char *value, void *vdata)
411411
} else if (strcmp(var, "core.worktree") == 0) {
412412
if (!value)
413413
return config_error_nonbool(var);
414+
free(data->work_tree);
414415
data->work_tree = xstrdup(value);
415416
}
416417
return 0;

0 commit comments

Comments
 (0)