Commit Diff


commit - 5a57034b6f08eec784b8fe3c0b0b734eb2d4605a
commit + bc95141ca7ce90e4b19a251b36c87601c150bb3f
blob - 04cc799c9db1c0359740a967662340d9eb76f2cd
blob + 4beb308778696b4c4299304065d186d28b072d3e
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
@@ -654,6 +654,8 @@ got_get_repo_tags(struct request *c, int limit)
 		if (error)
 			goto done;
 
+		if (tag)
+			got_object_tag_close(tag);
 		error = got_object_open_as_tag(&tag, repo, id);
 		if (error) {
 			if (error->code != GOT_ERR_OBJ_TYPE)
@@ -686,9 +688,6 @@ got_get_repo_tags(struct request *c, int limit)
 			    got_object_tag_get_object_id(tag));
 			if (error)
 				goto err;
-
-			got_object_tag_close(tag);
-			tag = NULL;
 		}
 
 		new_repo_tag->commit_id = strdup(id_str);