diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-03-20 13:11:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-20 13:11:53 -0700 |
commit | cfe96b38fddc114c0bc98bbeab51b0f18fd102c3 (patch) | |
tree | 257f93be22b4abcf5626c6d5f47268ace4dbec87 /bundle.c | |
parent | daea6fca3564e880dfe29bfab65fd5b608e9491d (diff) | |
parent | fd2014d42b3a4fb865d99e9a7943caa08082cada (diff) | |
download | git-cfe96b38fddc114c0bc98bbeab51b0f18fd102c3.tar.gz |
Merge branch 'sb/leaks'
Code cleanup.
* sb/leaks:
builtin/help.c: fix memory leak
bundle.c: fix memory leak
connect.c: do not leak "conn" after showing diagnosis
Diffstat (limited to 'bundle.c')
-rw-r--r-- | bundle.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -334,7 +334,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) if (e->item->flags & UNINTERESTING) continue; if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1) - continue; + goto skip_write_ref; if (read_ref_full(e->name, RESOLVE_REF_READING, sha1, &flag)) flag = 0; display_ref = (flag & REF_ISSYMREF) ? e->name : ref; @@ -342,7 +342,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) if (e->item->type == OBJ_TAG && !is_tag_in_date_range(e->item, revs)) { e->item->flags |= UNINTERESTING; - continue; + goto skip_write_ref; } /* @@ -357,8 +357,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) if (!(e->item->flags & SHOWN) && e->item->type == OBJ_COMMIT) { warning(_("ref '%s' is excluded by the rev-list options"), e->name); - free(ref); - continue; + goto skip_write_ref; } /* * If you run "git bundle create bndl v1.0..v2.0", the @@ -388,8 +387,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) obj->flags |= SHOWN; add_pending_object(revs, obj, e->name); } - free(ref); - continue; + goto skip_write_ref; } ref_count++; @@ -397,6 +395,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) write_or_die(bundle_fd, " ", 1); write_or_die(bundle_fd, display_ref, strlen(display_ref)); write_or_die(bundle_fd, "\n", 1); + skip_write_ref: free(ref); } |