Commit Diff


commit - e561e5d6269d818d1e814569e92ffb9150865e51
commit + 02f3bb77b3b9ba6d37db0410efee7bbaf3b6838e
blob - 3a28f952099603d8114ae09ad6df3f44a4e25998
blob + 07833deb5463d651b8b0bd06cf6edd39acf37365
--- gotd/session_read.c
+++ gotd/session_read.c
@@ -429,6 +429,8 @@ send_packfile(struct gotd_session_client *client)
 		err = got_error_from_errno("imsg compose SEND_PACKFILE");
 		close(pipe[0]);
 		close(pipe[1]);
+		close(client->delta_cache_fd);
+		client->delta_cache_fd = -1;
 		return err;
 	}
 
@@ -444,6 +446,7 @@ send_packfile(struct gotd_session_client *client)
 	if (gotd_imsg_compose_event(&client->iev,
 	    GOTD_IMSG_PACKFILE_PIPE, GOTD_PROC_GOTD, pipe[0], NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose PACKFILE_PIPE");
+		close(pipe[0]);
 		close(pipe[1]);
 		return err;
 	}
blob - 555bb907f17eb97429a2bdf6b979af83b6af85a3
blob + 2e2db1f20fa23fa3b9180c5a9700dd1bef9a7122
--- gotd/session_write.c
+++ gotd/session_write.c
@@ -1108,7 +1108,6 @@ recv_packfile(struct gotd_session_client *client)
 	    GOTD_IMSG_PACKFILE_PIPE, GOTD_PROC_SESSION_WRITE, pipe[0],
 	        NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose PACKFILE_PIPE");
-		pipe[0] = -1;
 		goto done;
 	}
 	pipe[0] = -1;
@@ -1116,8 +1115,10 @@ recv_packfile(struct gotd_session_client *client)
 	/* Send pack pipe end 1 to gotsh(1) (expects just an fd, no data). */
 	if (gotd_imsg_compose_event(&client->iev,
 	    GOTD_IMSG_PACKFILE_PIPE, GOTD_PROC_SESSION_WRITE, pipe[1],
-	    NULL, 0) == -1)
+	    NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose PACKFILE_PIPE");
+		goto done;
+	}
 	pipe[1] = -1;
 
 	if (asprintf(&basepath, "%s/%s/receiving-from-uid-%d.pack",
@@ -1155,7 +1156,6 @@ recv_packfile(struct gotd_session_client *client)
 	    GOTD_IMSG_PACKIDX_FILE, GOTD_PROC_SESSION_WRITE,
 	    idxfd, NULL, 0) == -1) {
 		err = got_error_from_errno("imsg compose PACKIDX_FILE");
-		idxfd = -1;
 		goto done;
 	}
 	idxfd = -1;
@@ -1168,7 +1168,6 @@ recv_packfile(struct gotd_session_client *client)
 	    GOTD_IMSG_RECV_PACKFILE, GOTD_PROC_SESSION_WRITE, packfd,
 	    &ipack, sizeof(ipack)) == -1) {
 		err = got_error_from_errno("imsg compose RECV_PACKFILE");
-		packfd = -1;
 		goto done;
 	}
 	packfd = -1;