Skip to content

Commit

Permalink
commit.c: fix a memory leak
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Stefan Beller authored and Junio C Hamano committed Mar 23, 2015
1 parent e280888 commit 5d0b9bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static int commit_index_files(void)
static int list_paths(struct string_list *list, const char *with_tree,
const char *prefix, const struct pathspec *pattern)
{
int i;
int i, ret;
char *m;

if (!pattern->nr)
Expand All @@ -256,7 +256,9 @@ static int list_paths(struct string_list *list, const char *with_tree,
item->util = item; /* better a valid pointer than a fake one */
}

return report_path_error(m, pattern, prefix);
ret = report_path_error(m, pattern, prefix);
free(m);
return ret;
}

static void add_remove_files(struct string_list *list)
Expand Down

0 comments on commit 5d0b9bf

Please sign in to comment.