summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2015-03-20 17:28:07 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-23 11:12:58 -0700
commit5d0b9bf86d98b690e443b266e95add7fab334f14 (patch)
tree731d1b925f9d20ded4217bddb3da9ecf9e92747b
parente280888cfb5c0fb5b75acaab04aa2ca28da3225b (diff)
downloadgit-5d0b9bf86d98b690e443b266e95add7fab334f14.tar.gz
commit.c: fix a memory leak
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/commit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 961e467242..da79ac4bc7 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -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)