summaryrefslogtreecommitdiff
path: root/builtin/update-index.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-11 07:21:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-11 07:21:51 (GMT)
commit77a24b7dc48f1690981c67a81119364f0a69f060 (patch)
tree727d28ddc9c71b410ab24ba2abe6423ff85ba7dd /builtin/update-index.c
parentd9758cf81cd8af42a7ab55dc3c1a889d9ddd3f81 (diff)
parentc105f563d1b8894af8a7bee68852e45831d55224 (diff)
downloadgit-77a24b7dc48f1690981c67a81119364f0a69f060.zip
git-77a24b7dc48f1690981c67a81119364f0a69f060.tar.gz
git-77a24b7dc48f1690981c67a81119364f0a69f060.tar.bz2
Merge branch 'cc/untracked'
Code cleanup. * cc/untracked: update-index: fix xgetcwd() related memory leak
Diffstat (limited to 'builtin/update-index.c')
-rw-r--r--builtin/update-index.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c
index d74d72c..ebfc09f 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -125,12 +125,16 @@ static int test_if_untracked_cache_is_supported(void)
struct stat st;
struct stat_data base;
int fd, ret = 0;
+ char *cwd;
strbuf_addstr(&mtime_dir, "mtime-test-XXXXXX");
if (!mkdtemp(mtime_dir.buf))
die_errno("Could not make temporary directory");
- fprintf(stderr, _("Testing mtime in '%s' "), xgetcwd());
+ cwd = xgetcwd();
+ fprintf(stderr, _("Testing mtime in '%s' "), cwd);
+ free(cwd);
+
atexit(remove_test_directory);
xstat_mtime_dir(&st);
fill_stat_data(&base, &st);