Commit Diff


commit - 33fd69c2e53ffe1f0a7e1184293f6918a377376d
commit + 1453347d2463ce1b2700dd9fa810f30f2a443e5e
blob - 24cb88f0abccde09929289877f3d5f359d4ea279
blob + 782f94ad26528e54d59fa5855bd1a0a4f674588b
--- lib/privsep.c
+++ lib/privsep.c
@@ -309,18 +309,12 @@ got_privsep_send_raw_obj(struct imsgbuf *ibuf, off_t s
 		return err;
 	}
 
-	if (imsg_add(wbuf, &iobj, sizeof(iobj)) == -1) {
-		err = got_error_from_errno("imsg_add RAW_OBJECT");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, &iobj, sizeof(iobj)) == -1)
+		return got_error_from_errno("imsg_add RAW_OBJECT");
 
 	if (data && size + hdrlen <= GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX) {
-		if (imsg_add(wbuf, data, size + hdrlen) == -1) {
-			err = got_error_from_errno("imsg_add RAW_OBJECT");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, data, size + hdrlen) == -1)
+			return got_error_from_errno("imsg_add RAW_OBJECT");
 	}
 
 	wbuf->fd = -1;
@@ -416,7 +410,6 @@ const struct got_error *
 got_privsep_send_tree_req(struct imsgbuf *ibuf, int fd,
     struct got_object_id *id, int pack_idx)
 {
-	const struct got_error *err = NULL;
 	struct ibuf *wbuf;
 	size_t len;
 
@@ -429,18 +422,12 @@ got_privsep_send_tree_req(struct imsgbuf *ibuf, int fd
 	if (wbuf == NULL)
 		return got_error_from_errno("imsg_create TREE_REQUEST");
 
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
-		err = got_error_from_errno("imsg_add TREE_REQUEST");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+		return got_error_from_errno("imsg_add TREE_REQUEST");
 
 	if (pack_idx != -1) { /* tree is packed */
-		if (imsg_add(wbuf, &pack_idx, sizeof(pack_idx)) == -1) {
-			err = got_error_from_errno("imsg_add TREE_REQUEST");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, &pack_idx, sizeof(pack_idx)) == -1)
+			return got_error_from_errno("imsg_add TREE_REQUEST");
 	}
 
 	wbuf->fd = fd;
@@ -611,21 +598,12 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int f
 			return got_error_from_errno("imsg_create FETCH_HAVE_REF");
 
 		/* Keep in sync with struct got_imsg_fetch_have_ref! */
-		if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -1) {
-			err = got_error_from_errno("imsg_add FETCH_HAVE_REF");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
-			err = got_error_from_errno("imsg_add FETCH_HAVE_REF");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, name, name_len) == -1) {
-			err = got_error_from_errno("imsg_add FETCH_HAVE_REF");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -1)
+			return got_error_from_errno("imsg_add FETCH_HAVE_REF");
+		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+			return got_error_from_errno("imsg_add FETCH_HAVE_REF");
+		if (imsg_add(wbuf, name, name_len) == -1)
+			return got_error_from_errno("imsg_add FETCH_HAVE_REF");
 
 		wbuf->fd = -1;
 		imsg_close(ibuf, wbuf);
@@ -646,18 +624,12 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int f
 			    "imsg_create FETCH_WANTED_BRANCH");
 
 		/* Keep in sync with struct got_imsg_fetch_wanted_branch! */
-		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
-			err = got_error_from_errno(
+		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+			return got_error_from_errno(
 			    "imsg_add FETCH_WANTED_BRANCH");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, name, name_len) == -1) {
-			err = got_error_from_errno(
+		if (imsg_add(wbuf, name, name_len) == -1)
+			return got_error_from_errno(
 			    "imsg_add FETCH_WANTED_BRANCH");
-			ibuf_free(wbuf);
-			return err;
-		}
 
 		wbuf->fd = -1;
 		imsg_close(ibuf, wbuf);
@@ -678,18 +650,12 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int f
 			    "imsg_create FETCH_WANTED_REF");
 
 		/* Keep in sync with struct got_imsg_fetch_wanted_ref! */
-		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
-			err = got_error_from_errno(
+		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+			return got_error_from_errno(
 			    "imsg_add FETCH_WANTED_REF");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, name, name_len) == -1) {
-			err = got_error_from_errno(
+		if (imsg_add(wbuf, name, name_len) == -1)
+			return got_error_from_errno(
 			    "imsg_add FETCH_WANTED_REF");
-			ibuf_free(wbuf);
-			return err;
-		}
 
 		wbuf->fd = -1;
 		imsg_close(ibuf, wbuf);
@@ -868,7 +834,6 @@ static const struct got_error *
 send_send_ref(const char *name, size_t name_len, struct got_object_id *id,
     int delete, struct imsgbuf *ibuf)
 {
-	const struct got_error *err = NULL;
 	size_t len;
 	struct ibuf *wbuf;
 
@@ -878,26 +843,14 @@ send_send_ref(const char *name, size_t name_len, struc
 		return got_error_from_errno("imsg_create SEND_REF");
 
 	/* Keep in sync with struct got_imsg_send_ref! */
-	if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, &delete, sizeof(delete)) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, name, name_len) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -1)
+		return got_error_from_errno("imsg_add SEND_REF");
+	if (imsg_add(wbuf, &delete, sizeof(delete)) == -1)
+		return got_error_from_errno("imsg_add SEND_REF");
+	if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+		return got_error_from_errno("imsg_add SEND_REF");
+	if (imsg_add(wbuf, name, name_len) == -1)
+		return got_error_from_errno("imsg_add SEND_REF");
 
 	wbuf->fd = -1;
 	imsg_close(ibuf, wbuf);
@@ -1493,7 +1446,6 @@ static const struct got_error *
 send_tree_entries(struct imsgbuf *ibuf, struct got_parsed_tree_entry *entries,
     int idx0, int idxN, size_t len)
 {
-	static const struct got_error *err;
 	struct ibuf *wbuf;
 	struct got_imsg_tree_entries ientries;
 	int i;
@@ -1503,38 +1455,23 @@ send_tree_entries(struct imsgbuf *ibuf, struct got_par
 		return got_error_from_errno("imsg_create TREE_ENTRY");
 
 	ientries.nentries = idxN - idx0 + 1;
-	if (imsg_add(wbuf, &ientries, sizeof(ientries)) == -1) {
-		err = got_error_from_errno("imsg_add TREE_ENTRY");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, &ientries, sizeof(ientries)) == -1)
+		return got_error_from_errno("imsg_add TREE_ENTRY");
 
 	for (i = idx0; i <= idxN; i++) {
 		struct got_parsed_tree_entry *pte = &entries[i];
 
 		/* Keep in sync with struct got_imsg_tree_object definition! */
-		if (imsg_add(wbuf, pte->id, SHA1_DIGEST_LENGTH) == -1) {
-			err = got_error_from_errno("imsg_add TREE_ENTRY");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, &pte->mode, sizeof(pte->mode)) == -1) {
-			err = got_error_from_errno("imsg_add TREE_ENTRY");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, &pte->namelen, sizeof(pte->namelen)) == -1) {
-			err = got_error_from_errno("imsg_add TREE_ENTRY");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, pte->id, SHA1_DIGEST_LENGTH) == -1)
+			return got_error_from_errno("imsg_add TREE_ENTRY");
+		if (imsg_add(wbuf, &pte->mode, sizeof(pte->mode)) == -1)
+			return got_error_from_errno("imsg_add TREE_ENTRY");
+		if (imsg_add(wbuf, &pte->namelen, sizeof(pte->namelen)) == -1)
+			return got_error_from_errno("imsg_add TREE_ENTRY");
 		
 		/* Remaining bytes are the entry's name. */
-		if (imsg_add(wbuf, pte->name, pte->namelen) == -1) {
-			err = got_error_from_errno("imsg_add TREE_ENTRY");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, pte->name, pte->namelen) == -1)
+			return got_error_from_errno("imsg_add TREE_ENTRY");
 	}
 
 	wbuf->fd = -1;
@@ -2693,7 +2630,6 @@ const struct got_error *
 got_privsep_send_commit_traversal_request(struct imsgbuf *ibuf,
     struct got_object_id *id, int idx, const char *path)
 {
-	const struct got_error *err = NULL;
 	struct ibuf *wbuf;
 	size_t path_len = strlen(path) + 1;
 
@@ -2702,21 +2638,15 @@ got_privsep_send_commit_traversal_request(struct imsgb
 	if (wbuf == NULL)
 		return got_error_from_errno(
 		    "imsg_create COMMIT_TRAVERSAL_REQUEST");
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
-		err = got_error_from_errno("imsg_add COMMIT_TRAVERSAL_REQUEST");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, &idx, sizeof(idx)) == -1) {
-		err = got_error_from_errno("imsg_add COMMIT_TRAVERSAL_REQUEST");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, path, path_len) == -1) {
-		err = got_error_from_errno("imsg_add COMMIT_TRAVERSAL_REQUEST");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+		return got_error_from_errno("imsg_add "
+		    "COMMIT_TRAVERSAL_REQUEST");
+	if (imsg_add(wbuf, &idx, sizeof(idx)) == -1)
+		return got_error_from_errno("imsg_add "
+		    "COMMIT_TRAVERSAL_REQUEST");
+	if (imsg_add(wbuf, path, path_len) == -1)
+		return got_error_from_errno("imsg_add "
+		    "COMMIT_TRAVERSAL_REQUEST");
 
 	wbuf->fd = -1;
 	imsg_close(ibuf, wbuf);
@@ -2924,19 +2854,13 @@ got_privsep_send_object_idlist(struct imsgbuf *ibuf,
 	}
 
 	idlist.nids = nids;
-	if (imsg_add(wbuf, &idlist, sizeof(idlist)) == -1) {
-		err = got_error_from_errno("imsg_add OBJ_ID_LIST");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, &idlist, sizeof(idlist)) == -1)
+		return got_error_from_errno("imsg_add OBJ_ID_LIST");
 
 	for (i = 0; i < nids; i++) {
 		struct got_object_id *id = ids[i];
-		if (imsg_add(wbuf, id, sizeof(*id)) == -1) {
-			err = got_error_from_errno("imsg_add OBJ_ID_LIST");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, id, sizeof(*id)) == -1)
+			return got_error_from_errno("imsg_add OBJ_ID_LIST");
 	}
 	
 	wbuf->fd = -1;
@@ -3036,19 +2960,13 @@ got_privsep_send_reused_deltas(struct imsgbuf *ibuf,
 	}
 
 	ideltas.ndeltas = ndeltas;
-	if (imsg_add(wbuf, &ideltas, sizeof(ideltas)) == -1) {
-		err = got_error_from_errno("imsg_add REUSED_DELTAS");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, &ideltas, sizeof(ideltas)) == -1)
+		return got_error_from_errno("imsg_add REUSED_DELTAS");
 
 	for (i = 0; i < ndeltas; i++) {
 		struct got_imsg_reused_delta *delta = &deltas[i];
-		if (imsg_add(wbuf, delta, sizeof(*delta)) == -1) {
-			err = got_error_from_errno("imsg_add REUSED_DELTAS");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, delta, sizeof(*delta)) == -1)
+			return got_error_from_errno("imsg_add REUSED_DELTAS");
 	}
 	
 	wbuf->fd = -1;
blob - 68f212c77a93dcbc4a7b95f45506eb02e5ec8f89
blob + 1cbce6b3ad5b6169b26f1ca72e58e3bb1bad9d7f
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -216,7 +216,6 @@ fetch_error(const char *buf, size_t len)
 static const struct got_error *
 send_fetch_symrefs(struct imsgbuf *ibuf, struct got_pathlist_head *symrefs)
 {
-	const struct got_error *err = NULL;
 	struct ibuf *wbuf;
 	size_t len, nsymrefs = 0;
 	struct got_pathlist_entry *pe;
@@ -237,11 +236,8 @@ send_fetch_symrefs(struct imsgbuf *ibuf, struct got_pa
 		return got_error_from_errno("imsg_create FETCH_SYMREFS");
 
 	/* Keep in sync with struct got_imsg_fetch_symrefs definition! */
-	if (imsg_add(wbuf, &nsymrefs, sizeof(nsymrefs)) == -1) {
-		err = got_error_from_errno("imsg_add FETCH_SYMREFS");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, &nsymrefs, sizeof(nsymrefs)) == -1)
+		return got_error_from_errno("imsg_add FETCH_SYMREFS");
 
 	TAILQ_FOREACH(pe, symrefs, entry) {
 		const char *name = pe->path;
@@ -250,26 +246,14 @@ send_fetch_symrefs(struct imsgbuf *ibuf, struct got_pa
 		size_t target_len = strlen(target);
 
 		/* Keep in sync with struct got_imsg_fetch_symref definition! */
-		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
-			err = got_error_from_errno("imsg_add FETCH_SYMREFS");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, &target_len, sizeof(target_len)) == -1) {
-			err = got_error_from_errno("imsg_add FETCH_SYMREFS");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, name, name_len) == -1) {
-			err = got_error_from_errno("imsg_add FETCH_SYMREFS");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, target, target_len) == -1) {
-			err = got_error_from_errno("imsg_add FETCH_SYMREFS");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+			return got_error_from_errno("imsg_add FETCH_SYMREFS");
+		if (imsg_add(wbuf, &target_len, sizeof(target_len)) == -1)
+			return got_error_from_errno("imsg_add FETCH_SYMREFS");
+		if (imsg_add(wbuf, name, name_len) == -1)
+			return got_error_from_errno("imsg_add FETCH_SYMREFS");
+		if (imsg_add(wbuf, target, target_len) == -1)
+			return got_error_from_errno("imsg_add FETCH_SYMREFS");
 	}
 
 	wbuf->fd = -1;
@@ -281,7 +265,6 @@ static const struct got_error *
 send_fetch_ref(struct imsgbuf *ibuf, struct got_object_id *refid,
     const char *refname)
 {
-	const struct got_error *err = NULL;
 	struct ibuf *wbuf;
 	size_t len, reflen = strlen(refname);
 
@@ -294,16 +277,10 @@ send_fetch_ref(struct imsgbuf *ibuf, struct got_object
 		return got_error_from_errno("imsg_create FETCH_REF");
 
 	/* Keep in sync with struct got_imsg_fetch_ref definition! */
-	if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1) {
-		err = got_error_from_errno("imsg_add FETCH_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, refname, reflen) == -1) {
-		err = got_error_from_errno("imsg_add FETCH_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1)
+		return got_error_from_errno("imsg_add FETCH_REF");
+	if (imsg_add(wbuf, refname, reflen) == -1)
+		return got_error_from_errno("imsg_add FETCH_REF");
 
 	wbuf->fd = -1;
 	imsg_close(ibuf, wbuf);
blob - a7d8b89126289ae87d2cfb9a6a8b0414e8cd9fc0
blob + eb2cb32cc344ddd544e7ee0c3ed70fb044acb212
--- libexec/got-read-gitconfig/got-read-gitconfig.c
+++ libexec/got-read-gitconfig/got-read-gitconfig.c
@@ -131,31 +131,19 @@ send_gitconfig_remotes(struct imsgbuf *ibuf, struct go
 			return got_error_from_errno(
 			    "imsg_create GITCONFIG_REMOTE");
 
-		if (imsg_add(wbuf, &iremote, sizeof(iremote)) == -1) {
-			err = got_error_from_errno(
+		if (imsg_add(wbuf, &iremote, sizeof(iremote)) == -1)
+			return got_error_from_errno(
 			    "imsg_add GITCONFIG_REMOTE");
-			ibuf_free(wbuf);
-			return err;
-		}
 
-		if (imsg_add(wbuf, remotes[i].name, iremote.name_len) == -1) {
-			err = got_error_from_errno(
-			    "imsg_add GITCONFIG_REMOTE");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, remotes[i].fetch_url, iremote.fetch_url_len) == -1) {
-			err = got_error_from_errno(
+		if (imsg_add(wbuf, remotes[i].name, iremote.name_len) == -1)
+			return got_error_from_errno(
 			    "imsg_add GITCONFIG_REMOTE");
-			ibuf_free(wbuf);
-			return err;
-		}
-		if (imsg_add(wbuf, remotes[i].send_url, iremote.send_url_len) == -1) {
-			err = got_error_from_errno(
+		if (imsg_add(wbuf, remotes[i].fetch_url, iremote.fetch_url_len) == -1)
+			return got_error_from_errno(
 			    "imsg_add GITCONFIG_REMOTE");
-			ibuf_free(wbuf);
-			return err;
-		}
+		if (imsg_add(wbuf, remotes[i].send_url, iremote.send_url_len) == -1)
+			return got_error_from_errno(
+			    "imsg_add GITCONFIG_REMOTE");
 
 		wbuf->fd = -1;
 		imsg_close(ibuf, wbuf);
blob - 3eb4560b62d19ac09c049067c235bc7051c1216c
blob + aa2c97552358174249a7361aba78c785626d6b7f
--- libexec/got-read-gotconfig/got-read-gotconfig.c
+++ libexec/got-read-gotconfig/got-read-gotconfig.c
@@ -310,26 +310,22 @@ send_gotconfig_remotes(struct imsgbuf *ibuf,
 		if (imsg_add(wbuf, &iremote, sizeof(iremote)) == -1) {
 			err = got_error_from_errno(
 			    "imsg_add GOTCONFIG_REMOTE");
-			ibuf_free(wbuf);
 			break;
 		}
 
 		if (imsg_add(wbuf, repo->name, iremote.name_len) == -1) {
 			err = got_error_from_errno(
 			    "imsg_add GOTCONFIG_REMOTE");
-			ibuf_free(wbuf);
 			break;
 		}
 		if (imsg_add(wbuf, fetch_url, iremote.fetch_url_len) == -1) {
 			err = got_error_from_errno(
 			    "imsg_add GOTCONFIG_REMOTE");
-			ibuf_free(wbuf);
 			break;
 		}
 		if (imsg_add(wbuf, send_url, iremote.send_url_len) == -1) {
 			err = got_error_from_errno(
 			    "imsg_add GOTCONFIG_REMOTE");
-			ibuf_free(wbuf);
 			break;
 		}
 
blob - b6d3c895f92db84cc93320a4f869170172782abd
blob + ea9a7e564cb840af0d6a61c8c8e0cf5ed3d93147
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -551,7 +551,6 @@ static const struct got_error *
 send_traversed_commits(struct got_object_id *commit_ids, size_t ncommits,
     struct imsgbuf *ibuf)
 {
-	const struct got_error *err;
 	struct ibuf *wbuf;
 	size_t i;
 
@@ -561,18 +560,14 @@ send_traversed_commits(struct got_object_id *commit_id
 	if (wbuf == NULL)
 		return got_error_from_errno("imsg_create TRAVERSED_COMMITS");
 
-	if (imsg_add(wbuf, &ncommits, sizeof(ncommits)) == -1) {
-		err = got_error_from_errno("imsg_add TRAVERSED_COMMITS");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, &ncommits, sizeof(ncommits)) == -1)
+		return got_error_from_errno("imsg_add TRAVERSED_COMMITS");
+
 	for (i = 0; i < ncommits; i++) {
 		struct got_object_id *id = &commit_ids[i];
 		if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
-			err = got_error_from_errno(
+			return got_error_from_errno(
 			    "imsg_add TRAVERSED_COMMITS");
-			ibuf_free(wbuf);
-			return err;
 		}
 	}
 
blob - e3a4b185b73dabfec5854af9ec5c835f0a9c610d
blob + 1f78b772985528812977992b4f114463433ce59e
--- libexec/got-send-pack/got-send-pack.c
+++ libexec/got-send-pack/got-send-pack.c
@@ -195,7 +195,6 @@ static const struct got_error *
 send_their_ref(struct imsgbuf *ibuf, struct got_object_id *refid,
     const char *refname)
 {
-	const struct got_error *err = NULL;
 	struct ibuf *wbuf;
 	size_t len, reflen = strlen(refname);
 
@@ -208,21 +207,12 @@ send_their_ref(struct imsgbuf *ibuf, struct got_object
 		return got_error_from_errno("imsg_create SEND_REMOTE_REF");
 
 	/* Keep in sync with struct got_imsg_send_remote_ref definition! */
-	if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REMOTE_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REMOTE_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, refname, reflen) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REMOTE_REF");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1)
+		return got_error_from_errno("imsg_add SEND_REMOTE_REF");
+	if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1)
+		return got_error_from_errno("imsg_add SEND_REMOTE_REF");
+	if (imsg_add(wbuf, refname, reflen) == -1)
+		return got_error_from_errno("imsg_add SEND_REMOTE_REF");
 
 	wbuf->fd = -1;
 	imsg_close(ibuf, wbuf);
@@ -233,7 +223,6 @@ static const struct got_error *
 send_ref_status(struct imsgbuf *ibuf, const char *refname, int success,
     struct got_pathlist_head *refs, struct got_pathlist_head *delete_refs)
 {
-	const struct got_error *err = NULL;
 	struct ibuf *wbuf;
 	size_t len, reflen = strlen(refname);
 	struct got_pathlist_entry *pe;
@@ -276,21 +265,12 @@ send_ref_status(struct imsgbuf *ibuf, const char *refn
 		return got_error_from_errno("imsg_create SEND_REF_STATUS");
 
 	/* Keep in sync with struct got_imsg_send_ref_status definition! */
-	if (imsg_add(wbuf, &success, sizeof(success)) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REF_STATUS");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REF_STATUS");
-		ibuf_free(wbuf);
-		return err;
-	}
-	if (imsg_add(wbuf, refname, reflen) == -1) {
-		err = got_error_from_errno("imsg_add SEND_REF_STATUS");
-		ibuf_free(wbuf);
-		return err;
-	}
+	if (imsg_add(wbuf, &success, sizeof(success)) == -1)
+		return got_error_from_errno("imsg_add SEND_REF_STATUS");
+	if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1)
+		return got_error_from_errno("imsg_add SEND_REF_STATUS");
+	if (imsg_add(wbuf, refname, reflen) == -1)
+		return got_error_from_errno("imsg_add SEND_REF_STATUS");
 
 	wbuf->fd = -1;
 	imsg_close(ibuf, wbuf);