Skip to content

Commit

Permalink
Fix a small memory leak in builtin-add
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Benoit Sigoure authored and Junio C Hamano committed Oct 29, 2007
1 parent 1c1f79a commit 399f0a8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
die("pathspec '%s' did not match any files",
pathspec[i]);
}
free(seen);
}

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

static int git_add_config(const char *var, const char *value)
Expand Down

0 comments on commit 399f0a8

Please sign in to comment.