Commit Diff


commit - 85a99d1ea6ce4169303c521409e5527f69826641
commit + c877c437470e41e7f70828c916ff40189b097fe2
blob - 61992d2553baf27890c541fea662c105db402a7d
blob + ae6de06b406405893b822d52382ee6165539e3b3
--- lib/commit_graph.c
+++ lib/commit_graph.c
@@ -446,10 +446,12 @@ add_branch_tip(struct got_object_id *commit_id, void *
 		return err;
 
 	err = add_node(&new_node, a->graph, commit_id, a->repo);
-	if (err)
+	if (err) {
+		got_object_commit_close(commit);
 		return err;
+	}
 
-	a->tips[a->ntips].commit_id = new_node ? &new_node->id : NULL;
+	a->tips[a->ntips].commit_id = &new_node->id;
 	a->tips[a->ntips].commit = commit;
 	a->tips[a->ntips].new_node = new_node;
 	a->ntips++;