remove a pointless object-id dup/free dance in findtwixt()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
diff --git a/lib/pack_create.c b/lib/pack_create.c
index 424716c..bae2f1f 100644
--- a/lib/pack_create.c
+++ b/lib/pack_create.c
@@ -1333,38 +1333,27 @@ findtwixt(struct got_object_id ***res, int *nres, int *ncolored,
goto done;
} else if (ncolor == COLOR_BLANK) {
struct got_commit_object *commit;
- struct got_object_id *id;
const struct got_object_id_queue *parents;
struct got_object_qid *pid;
- id = got_object_id_dup(qid->id);
- if (id == NULL) {
- err = got_error_from_errno("got_object_id_dup");
- goto done;
- }
if (qcolor == COLOR_KEEP)
- err = got_object_idset_add(keep, id, NULL);
+ err = got_object_idset_add(keep, qid->id, NULL);
else
- err = got_object_idset_add(drop, id, NULL);
- if (err) {
- free(id);
+ err = got_object_idset_add(drop, qid->id, NULL);
+ if (err)
goto done;
- }
- err = got_object_open_as_commit(&commit, repo, id);
- if (err) {
- free(id);
+ err = got_object_open_as_commit(&commit, repo, qid->id);
+ if (err)
goto done;
- }
+
parents = got_object_commit_get_parent_ids(commit);
if (parents) {
STAILQ_FOREACH(pid, parents, entry) {
err = queue_commit_id(&ids, pid->id,
qcolor, repo);
- if (err) {
- free(id);
+ if (err)
goto done;
- }
}
}
got_object_commit_close(commit);