diff options
Diffstat (limited to 'bundle.c')
-rw-r--r-- | bundle.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -157,9 +157,14 @@ int verify_bundle(struct bundle_header *header, int verbose) req_nr = revs.pending.nr; setup_revisions(2, argv, &revs, NULL); + /* Save pending objects, so they can be cleaned up later. */ refs = revs.pending; revs.leak_pending = 1; + /* + * prepare_revision_walk (together with .leak_pending = 1) makes us + * the sole owner of the list of pending objects. + */ if (prepare_revision_walk(&revs)) die(_("revision walk setup failed")); @@ -176,8 +181,10 @@ int verify_bundle(struct bundle_header *header, int verbose) refs.objects[i].name); } + /* Clean up objects used, as they will be reused. */ clear_commit_marks_for_object_array(&refs, ALL_REV_FLAGS); - free(refs.objects); + + object_array_clear(&refs); if (verbose) { struct ref_list *r; @@ -331,9 +338,9 @@ 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), oid.hash, &ref) != 1) + if (dwim_ref(e->name, strlen(e->name), &oid, &ref) != 1) goto skip_write_ref; - if (read_ref_full(e->name, RESOLVE_REF_READING, oid.hash, &flag)) + if (read_ref_full(e->name, RESOLVE_REF_READING, &oid, &flag)) flag = 0; display_ref = (flag & REF_ISSYMREF) ? e->name : ref; |