Commit Diff


commit - d0407b8677a44f0789c2f4cd238db49b3a28d6b1
commit + 38ef2333dd2b85b1e6aed14ef36bca80cb8eb551
blob - 5e95ca3316302472e74abae334031fd6835220aa
blob + 850056f73d0f8671f6fc63162e2753e92b8b8c41
--- got/got.c
+++ got/got.c
@@ -2483,14 +2483,18 @@ cmd_fetch(int argc, char *argv[])
 		if (!fetch_all_branches)
 			fetch_all_branches = remote->fetch_all_branches;
 		for (i = 0; i < remote->nfetch_branches; i++) {
-			got_pathlist_append(&wanted_branches,
+			error = got_pathlist_append(&wanted_branches,
 			    remote->fetch_branches[i], NULL);
+			if (error)
+				goto done;
 		}
 	}
 	if (TAILQ_EMPTY(&wanted_refs)) {
 		for (i = 0; i < remote->nfetch_refs; i++) {
-			got_pathlist_append(&wanted_refs,
+			error = got_pathlist_append(&wanted_refs,
 			    remote->fetch_refs[i], NULL);
+			if (error)
+				goto done;
 		}
 	}
 
@@ -9287,8 +9291,10 @@ cmd_send(int argc, char *argv[])
 		}
 	} else if (nbranches == 0) {
 		for (i = 0; i < remote->nsend_branches; i++) {
-			got_pathlist_append(&branches,
+			error = got_pathlist_append(&branches,
 			    remote->send_branches[i], NULL);
+			if (error)
+				goto done;
 		}
 	}