commit.c: fix a memory leak

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2015-03-20 17:28:07 -07:00 committed by Junio C Hamano
parent e280888cfb
commit 5d0b9bf86d

View File

@ -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)
@ -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)