Commit Diff


commit - 742ba378f35f128090420ae26cd13135741f1b8c
commit + 17d4bf8dd5ea178b0a6fab42c97b0b297351e2ee
blob - 8a6f5ac9e50eec4997019d018b05dfccff77b23c
blob + 044dc9e08c5a819bd26600218c57e38dfee83d84
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -2396,19 +2396,8 @@ gw_get_repo_age(char **repo_age, struct gw_trans *gw_t
 		goto done;
 
 	SIMPLEQ_FOREACH(re, &refs, entry) {
-		if (is_head) {
-			refname = strdup(repo_ref);
-			if (refname == NULL) {
-				error = got_error_from_errno("strdup");
-				goto done;
-			}
-		} else {
-			refname = got_ref_get_name(re->ref);
-			if (refname == NULL) {
-				error = got_error_from_errno("strdup");
-				goto done;
-			}
-		}
+		refname = is_head ? repo_ref : got_ref_get_name(re->ref);
+
 		error = got_ref_open(&head_ref, repo, refname, 0);
 		if (error)
 			goto done;