Skip to content

Commit 399f0a8

Browse files
tsunagitster
authored andcommitted
Fix a small memory leak in builtin-add
prune_directory and fill_directory allocated one byte per pathspec and never freed it. Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 1c1f79a commit 399f0a8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin-add.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
4444
die("pathspec '%s' did not match any files",
4545
pathspec[i]);
4646
}
47+
free(seen);
4748
}
4849

4950
static void fill_directory(struct dir_struct *dir, const char **pathspec,
@@ -140,6 +141,7 @@ static void refresh(int verbose, const char **pathspec)
140141
if (!seen[i])
141142
die("pathspec '%s' did not match any files", pathspec[i]);
142143
}
144+
free(seen);
143145
}
144146

145147
static int git_add_config(const char *var, const char *value)

0 commit comments

Comments
 (0)