Commit Diff


commit - f3933be66b2ab372f0f0b48b3dec7bc6d21b170a
commit + 07894e99b111edc91d20565e0982344b52b32095
blob - d6f2ff50944b11b7cb15e97a7d921fbfafbb435e
blob + eef4b7c66bd8feeeeffa738f9db15886bd8d4de8
--- 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++;