summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2015-03-21 00:28:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-23 18:12:58 (GMT)
commit5d0b9bf86d98b690e443b266e95add7fab334f14 (patch)
tree731d1b925f9d20ded4217bddb3da9ecf9e92747b /builtin
parente280888cfb5c0fb5b75acaab04aa2ca28da3225b (diff)
downloadgit-5d0b9bf86d98b690e443b266e95add7fab334f14.zip
git-5d0b9bf86d98b690e443b266e95add7fab334f14.tar.gz
git-5d0b9bf86d98b690e443b266e95add7fab334f14.tar.bz2
commit.c: fix a memory leak
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 961e467..da79ac4 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)