summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-27 20:02:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-27 20:02:32 (GMT)
commit553c622b685f0a7a83c77617377f08019d76c682 (patch)
tree59a6165ca81d3355fe9279a929563fd1c0b91d55 /builtin
parent2dfb2e07cb0cb979f630643b57dca579a0359a9d (diff)
parent826aed50cbb072d8f159e4c8ba0f9bd3df21a234 (diff)
downloadgit-553c622b685f0a7a83c77617377f08019d76c682.zip
git-553c622b685f0a7a83c77617377f08019d76c682.tar.gz
git-553c622b685f0a7a83c77617377f08019d76c682.tar.bz2
Merge branch 'sb/leaks'
* sb/leaks: http: release the memory of a http pack request as well read-cache: fix memleak add_to_index(): free unused cache-entry commit.c: fix a memory leak http-push: remove unneeded cleanup merge-recursive: fix memleaks merge-blobs.c: fix a memleak builtin/apply.c: fix a memleak update-index: fix a memleak read-cache: free cache entry in add_to_index in case of early return
Diffstat (limited to 'builtin')
-rw-r--r--builtin/apply.c4
-rw-r--r--builtin/commit.c6
-rw-r--r--builtin/update-index.c1
3 files changed, 8 insertions, 3 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 65b97ee..0769b09 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -2776,7 +2776,8 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
default:
if (apply_verbosely)
error(_("invalid start of line: '%c'"), first);
- return -1;
+ applied_pos = -1;
+ goto out;
}
if (added_blank_line) {
if (!new_blank_lines_at_end)
@@ -2915,6 +2916,7 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
(int)(old - oldlines), oldlines);
}
+out:
free(oldlines);
strbuf_release(&newlines);
free(preimage.line_allocated);
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)
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 5878986..6271b54 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -584,6 +584,7 @@ static int do_reupdate(int ac, const char **av,
path = xstrdup(ce->name);
update_one(path);
free(path);
+ free(old);
if (save_nr != active_nr)
goto redo;
}