Skip to content

Commit 77a24b7

Browse files
committed
Merge branch 'cc/untracked'
Code cleanup. * cc/untracked: update-index: fix xgetcwd() related memory leak
2 parents d9758cf + c105f56 commit 77a24b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

builtin/update-index.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,16 @@ static int test_if_untracked_cache_is_supported(void)
125125
struct stat st;
126126
struct stat_data base;
127127
int fd, ret = 0;
128+
char *cwd;
128129

129130
strbuf_addstr(&mtime_dir, "mtime-test-XXXXXX");
130131
if (!mkdtemp(mtime_dir.buf))
131132
die_errno("Could not make temporary directory");
132133

133-
fprintf(stderr, _("Testing mtime in '%s' "), xgetcwd());
134+
cwd = xgetcwd();
135+
fprintf(stderr, _("Testing mtime in '%s' "), cwd);
136+
free(cwd);
137+
134138
atexit(remove_test_directory);
135139
xstat_mtime_dir(&st);
136140
fill_stat_data(&base, &st);

0 commit comments

Comments
 (0)