"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
gotwebd: don't got_ref_list per-commit in got_get_repo_commits
To:
gameoftrees@openbsd.org
Date:
Sun, 22 Jan 2023 09:38:15 +0100

Download raw body.

Thread
`refs' is already populated via got_ref_list before the loop begins,
so it's redundant and wasteful to re-list and free inside the loop,
other than probably a leak.

diff -s /home/op/w/got
commit - 88a82656f65fee52fe135baccb76624ae8e1e2e4
path + /home/op/w/got (staged changes)
blob - 78b5a2623d4338f679a254321a0a0647a5ff85fd
blob + cb7924b39f5629118d7515bb7ae7bce48d66c550
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
@@ -436,11 +436,6 @@ got_get_repo_commits(struct request *c, int limit)
 		if (error)
 			goto done;
 
-		error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name,
-		    NULL);
-		if (error)
-			goto done;
-
 		error = got_init_repo_commit(&repo_commit);
 		if (error)
 			goto done;
@@ -505,7 +500,6 @@ got_get_repo_commits(struct request *c, int limit)
 				goto done;
 			}
 		}
-		got_ref_list_free(&refs);
 		if (error || (limit && --limit == 0)) {
 			if (commit_found || (qs->file != NULL &&
 			    strlen(qs->file) > 0))