diff options
Diffstat (limited to 'environment.c')
-rw-r--r-- | environment.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/environment.c b/environment.c index 23a38e4b14..2da7fe2e06 100644 --- a/environment.c +++ b/environment.c @@ -144,11 +144,8 @@ static char *git_path_from_env(const char *envvar, const char *git_dir, const char *path, int *fromenv) { const char *value = getenv(envvar); - if (!value) { - char *buf = xmalloc(strlen(git_dir) + strlen(path) + 2); - sprintf(buf, "%s/%s", git_dir, path); - return buf; - } + if (!value) + return xstrfmt("%s/%s", git_dir, path); if (fromenv) *fromenv = 1; return xstrdup(value); |