Commit 688fe08b75a31d11eaf64a44751f903bdfa61b68

Omar Polo 2022-02-14T13:14:36

fix fd leak in got_fetch_pack, ok stsp@

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/lib/fetch.c b/lib/fetch.c
index 6c0dbf4..66bbb44 100644
--- a/lib/fetch.c
+++ b/lib/fetch.c
@@ -353,6 +353,10 @@ got_fetch_pack(struct got_object_id **pack_hash, struct got_pathlist_head *refs,
 			packfile_size = packfile_size_cur;
 		}
 	}
+	if (close(imsg_fetchfds[0]) == -1) {
+		err = got_error_from_errno("close");
+		goto done;
+	}
 	if (waitpid(fetchpid, &fetchstatus, 0) == -1) {
 		err = got_error_from_errno("waitpid");
 		goto done;