P6.0: smb_vfs_io_pool_destructor
authorStefan Metzmacher <metze@samba.org>
Fri, 2 Oct 2020 14:29:27 +0000 (16:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 16 Oct 2023 11:03:51 +0000 (13:03 +0200)
source3/smbd/vfs.c

index 3ceeabb1c3aebd70da3e20e268cc14354c2d81c3..f2542692eec39f596e996e358a95ea02ebab1097 100644 (file)
@@ -1770,6 +1770,11 @@ struct smb_vfs_io {
        size_t pipesz;
 };
 
+static int smb_vfs_io_pool_destructor(struct smb_vfs_io_pool *pool)
+{
+       return 0;
+}
+
 static int smb_vfs_io_destructor(struct smb_vfs_io *io)
 {
        int ret;
@@ -1791,6 +1796,11 @@ static int smb_vfs_io_destructor(struct smb_vfs_io *io)
        }
 
        DLIST_REMOVE(io->pool->busy_list, io);
+               close(io->pipefds[0]);
+               io->pipefds[0] = -1;
+               close(io->pipefds[1]);
+               io->pipefds[1] = -1;
+               return 0;
        DLIST_ADD_END(io->pool->free_list, io);
        talloc_steal(io->pool, io);
        return -1;
@@ -1905,6 +1915,8 @@ struct smb_vfs_io_pool *smb_vfs_io_pool_create(TALLOC_CTX *mem_ctx,
                .dev_null_fd = -1,
        };
 
+       talloc_set_destructor(pool, smb_vfs_io_pool_destructor);
+
        while (pool->cur_count < pool->min_count) {
                int ret;