commit 07894e99b111edc91d20565e0982344b52b32095 from: Omar Polo via: Thomas Adam date: Sun Sep 04 15:52:15 2022 UTC free commit on error path while here drop the ternary too: if add_node succeeds `new_node' is non-NULL. ok stsp@ 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++;