Commit 0dd5271bd8f2a4f92ac3536fcc493eebc39b86e5

Stefan Sperling 2019-05-10T19:57:25

plug fd leak in got_pack_stop_privsep_child()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/pack.c b/lib/pack.c
index 94d6d9c..5de6375 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -496,6 +496,8 @@ got_pack_stop_privsep_child(struct got_pack *pack)
 	if (err)
 		return err;
 	err = got_privsep_wait_for_child(pack->privsep_child->pid);
+	if (close(pack->privsep_child->imsg_fd) != 0 && err == NULL)
+		err = got_error_from_errno();
 	free(pack->privsep_child);
 	pack->privsep_child = NULL;
 	return err;