Commit Diff


commit - 30c0868d39a478a260b1a028088d633785bf6da1
commit + 76b4ead2785ecd941602fa1a0aca516777bffd47
blob - 1d64acc3e5b59aa53a4c744828a2b66f11618e57
blob + fd2f57f3b5b776e534fe7f966be03fb9632aed0d
--- lib/reference.c
+++ lib/reference.c
@@ -474,8 +474,11 @@ got_ref_list(struct got_reflist_head *refs, struct got
 			err = parse_packed_ref_line(&ref, NULL, line);
 			if (err)
 				goto done;
-			if (ref)
-				append_ref(refs, ref, repo);
+			if (ref) {
+				err = append_ref(refs, ref, repo);
+				if (err)
+					goto done;
+			}
 		}
 	}
 
@@ -489,7 +492,9 @@ got_ref_list(struct got_reflist_head *refs, struct got
 	free(path_refs);
 	if (err)
 		goto done;
-	append_ref(refs, ref, repo);
+	err = append_ref(refs, ref, repo);
+	if (err)
+		goto done;
 
 done:
 	if (f)