commit 5faaa590496ab216fcb45ffd1846ff4dc425237f from: Stefan Sperling via: Thomas Adam date: Sat Apr 16 08:06:59 2022 UTC remove a pointless object-id dup/free dance in findtwixt() commit - 21a0da85073bec1c322c554d9bba1ffba5fdf66b commit + 5faaa590496ab216fcb45ffd1846ff4dc425237f blob - 6e3b92ab0fbe2a9a380fc01969f06b75b3861ad9 blob + cd36543257c4022c208f5dd8bcd03686acb074c6 --- lib/pack_create.c +++ lib/pack_create.c @@ -1332,38 +1332,27 @@ findtwixt(struct got_object_id ***res, int *nres, int 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);