From 4023aa7f1c858e106610f4b2b12dec00d9fa9b01 Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Mon, 31 Jul 2017 11:06:49 +0100 Subject: [PATCH] xfuse_create_share() called before xfuse_init() * Initialise inode table in `xfuse_create_share()` if necessary * Add guard to `xfuse_init_xrdp_fs()` to prevent double initialisation of the inode table --- sesman/chansrv/chansrv_fuse.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c index 31353ee4..ff50f136 100644 --- a/sesman/chansrv/chansrv_fuse.c +++ b/sesman/chansrv/chansrv_fuse.c @@ -611,6 +611,12 @@ int xfuse_create_share(tui32 device_id, const char *dirname) if (dirname == NULL || strlen(dirname) == 0) return -1; + /* Do we have an inode table yet? */ + if (xfuse_init_xrdp_fs()) + { + return -1; + } + xinode = g_new0(struct xrdp_inode, 1); if (xinode == NULL) { @@ -858,6 +864,12 @@ static int xfuse_init_xrdp_fs(void) { struct xrdp_inode *xino; + /* Already called? */ + if (g_xrdp_fs.inode_table != NULL) + { + return 0; + } + g_xrdp_fs.inode_table = g_new0(struct xrdp_inode *, 4096); if (g_xrdp_fs.inode_table == NULL) {